From 9c48aee522dcdd37f81ffce6d94386c9166aa512 Mon Sep 17 00:00:00 2001 From: David Bruno Vontor Date: Sun, 21 Dec 2025 04:42:15 +0100 Subject: [PATCH] feat(api): generate models for patched products, refunds, site configurations, payments, and user registration - Added PatchedProduct, PatchedProductImage, PatchedRefund, and related models. - Introduced Payment, PaymentBody, PaymentCreate, and PaymentRead models. - Created enums for payment methods, reasons for refunds, roles, and shipping methods. - Implemented models for site configurations and their opening hours. - Added ZasilkovnaPacket and ZasilkovnaShipment models for handling shipping data. - Generated user registration model with validation rules. - Updated public API functions to support new models and queries. --- backend/thirdparty/downloader/views.py | 37 +- frontend/Dockerfile.prod | 2 + frontend/src/api/README.md | 105 + frontend/src/api/generated/private/api/api.ts | 5186 +++++++++++++++++ .../private/categories/categories.ts | 1087 ++++ .../private/discount-codes/discount-codes.ts | 1092 ++++ frontend/src/api/generated/private/filler | 0 .../api/generated/private/go-pay/go-pay.ts | 525 ++ .../private/models/additionalParam.ts | 10 + .../models/apiAccountUsersListParams.ts | 23 + ...iAdvertisementContactMessagesListParams.ts | 12 + .../models/apiCommerceCategoriesListParams.ts | 20 + .../apiCommerceDiscountCodesListParams.ts | 20 + .../models/apiCommerceOrdersListParams.ts | 12 + .../apiCommerceProductImagesListParams.ts | 20 + .../models/apiCommerceProductsListParams.ts | 20 + .../models/apiCommerceRefundsListParams.ts | 12 + ...urationAdminShopConfigurationListParams.ts | 12 + ...rationPublicShopConfigurationListParams.ts | 12 + .../models/apiSchemaRetrieve200Four.ts | 7 + .../private/models/apiSchemaRetrieve200One.ts | 7 + .../models/apiSchemaRetrieve200Three.ts | 7 + .../private/models/apiSchemaRetrieve200Two.ts | 7 + .../private/models/apiSchemaRetrieveFormat.ts | 14 + .../private/models/apiSchemaRetrieveLang.ts | 111 + .../private/models/apiSchemaRetrieveParams.ts | 12 + .../apiZasilkovnaShipmentsListParams.ts | 12 + .../api/generated/private/models/callback.ts | 10 + .../generated/private/models/carrierRead.ts | 16 + .../api/generated/private/models/category.ts | 20 + .../api/generated/private/models/contact.ts | 16 + .../api/generated/private/models/contactMe.ts | 13 + .../generated/private/models/currencyEnum.ts | 17 + .../private/models/customTokenObtainPair.ts | 10 + .../generated/private/models/customUser.ts | 45 + .../generated/private/models/discountCode.ts | 39 + .../private/models/downloadErrorResponse.ts | 10 + .../private/models/downloadRequest.ts | 36 + .../private/models/downloaderStats.ts | 19 + .../generated/private/models/errorResponse.ts | 9 + .../api/generated/private/models/extEnum.ts | 27 + .../generated/private/models/formatEnum.ts | 27 + .../private/models/gopayCreatePayment201.ts | 7 + .../private/models/gopayGetStatus200.ts | 7 + .../private/models/gopayRefundPayment200.ts | 7 + .../src/api/generated/private/models/index.ts | 101 + .../src/api/generated/private/models/item.ts | 17 + .../generated/private/models/orderCarrier.ts | 17 + .../generated/private/models/orderCreate.ts | 24 + .../private/models/orderItemCreate.ts | 11 + .../generated/private/models/orderItemRead.ts | 12 + .../api/generated/private/models/orderMini.ts | 14 + .../api/generated/private/models/orderRead.ts | 34 + .../private/models/paginatedCategoryList.ts | 15 + .../private/models/paginatedContactMeList.ts | 15 + .../private/models/paginatedCustomUserList.ts | 15 + .../models/paginatedDiscountCodeList.ts | 15 + .../private/models/paginatedOrderReadList.ts | 15 + .../models/paginatedProductImageList.ts | 15 + .../private/models/paginatedProductList.ts | 15 + .../private/models/paginatedRefundList.ts | 15 + .../paginatedSiteConfigurationAdminList.ts | 15 + .../paginatedSiteConfigurationPublicList.ts | 15 + .../models/paginatedZasilkovnaShipmentList.ts | 15 + .../private/models/passwordResetConfirm.ts | 10 + .../private/models/passwordResetRequest.ts | 10 + .../private/models/patchedCategory.ts | 20 + .../private/models/patchedContactMe.ts | 13 + .../private/models/patchedCustomUser.ts | 45 + .../private/models/patchedDiscountCode.ts | 39 + .../private/models/patchedOrderRead.ts | 34 + .../private/models/patchedProduct.ts | 39 + .../private/models/patchedProductImage.ts | 14 + .../generated/private/models/patchedRefund.ts | 15 + .../models/patchedSiteConfigurationAdmin.ts | 77 + ...tchedSiteConfigurationAdminOpeningHours.ts | 10 + .../src/api/generated/private/models/payer.ts | 14 + .../api/generated/private/models/payment.ts | 16 + .../generated/private/models/paymentBody.ts | 26 + .../generated/private/models/paymentCreate.ts | 11 + .../private/models/paymentMethodEnum.ts | 20 + .../generated/private/models/paymentRead.ts | 10 + .../api/generated/private/models/product.ts | 39 + .../generated/private/models/productImage.ts | 14 + .../generated/private/models/productMini.ts | 13 + .../private/models/reasonChoiceEnum.ts | 22 + .../api/generated/private/models/refund.ts | 15 + .../api/generated/private/models/roleEnum.ts | 19 + .../private/models/shippingMethodEnum.ts | 18 + .../private/models/siteConfigurationAdmin.ts | 77 + .../siteConfigurationAdminOpeningHours.ts | 10 + .../private/models/siteConfigurationPublic.ts | 56 + .../siteConfigurationPublicOpeningHours.ts | 10 + .../generated/private/models/stateE15Enum.ts | 27 + .../generated/private/models/stateFdaEnum.ts | 21 + .../generated/private/models/statusEnum.ts | 23 + .../generated/private/models/trackingURL.ts | 10 + .../private/models/userRegistration.ts | 53 + .../private/models/videoInfoResponse.ts | 15 + .../private/models/zasilkovnaPacket.ts | 32 + .../private/models/zasilkovnaPacketRead.ts | 32 + .../zasilkovnaPacketReadReturnRouting.ts | 11 + .../models/zasilkovnaPacketReturnRouting.ts | 11 + .../private/models/zasilkovnaShipment.ts | 15 + .../src/api/generated/private/order/order.ts | 102 + .../api/generated/private/orders/orders.ts | 694 +++ .../api/generated/private/packet/packet.ts | 1252 ++++ .../packeta-shipment/packeta-shipment.ts | 719 +++ .../private/product-images/product-images.ts | 1092 ++++ .../generated/private/products/products.ts | 1066 ++++ .../api/generated/private/refunds/refunds.ts | 1064 ++++ .../api/generated/private/stripe/stripe.ts | 88 + .../private/trading212/trading212.ts | 622 ++ .../user-password-reset.ts | 194 + .../user-registration/user-registration.ts | 463 ++ .../src/api/generated/private/user/user.ts | 1346 +++++ .../api/generated/public/authentication.ts | 256 + .../src/api/generated/public/downloader.ts | 431 ++ frontend/src/api/generated/public/filler | 0 .../public/models/additionalParam.ts | 10 + .../public/models/apiChoicesRetrieve200.ts | 10 + .../models/apiChoicesRetrieve200Item.ts | 12 + .../public/models/apiChoicesRetrieveParams.ts | 16 + .../apiDownloaderDownloadRetrieveParams.ts | 13 + .../api/generated/public/models/callback.ts | 10 + .../generated/public/models/carrierRead.ts | 16 + .../api/generated/public/models/category.ts | 20 + .../api/generated/public/models/contact.ts | 16 + .../api/generated/public/models/contactMe.ts | 13 + .../generated/public/models/currencyEnum.ts | 17 + .../public/models/customTokenObtainPair.ts | 10 + .../api/generated/public/models/customUser.ts | 45 + .../generated/public/models/discountCode.ts | 39 + .../public/models/downloadErrorResponse.ts | 10 + .../public/models/downloadRequest.ts | 36 + .../public/models/downloaderStats.ts | 19 + .../generated/public/models/errorResponse.ts | 9 + .../api/generated/public/models/extEnum.ts | 27 + .../api/generated/public/models/formatEnum.ts | 27 + .../src/api/generated/public/models/index.ts | 84 + .../src/api/generated/public/models/item.ts | 17 + .../generated/public/models/orderCarrier.ts | 17 + .../generated/public/models/orderCreate.ts | 24 + .../public/models/orderItemCreate.ts | 11 + .../generated/public/models/orderItemRead.ts | 12 + .../api/generated/public/models/orderMini.ts | 14 + .../api/generated/public/models/orderRead.ts | 34 + .../public/models/paginatedCategoryList.ts | 15 + .../public/models/paginatedContactMeList.ts | 15 + .../public/models/paginatedCustomUserList.ts | 15 + .../models/paginatedDiscountCodeList.ts | 15 + .../public/models/paginatedOrderReadList.ts | 15 + .../models/paginatedProductImageList.ts | 15 + .../public/models/paginatedProductList.ts | 15 + .../public/models/paginatedRefundList.ts | 15 + .../paginatedSiteConfigurationAdminList.ts | 15 + .../paginatedSiteConfigurationPublicList.ts | 15 + .../models/paginatedZasilkovnaShipmentList.ts | 15 + .../public/models/passwordResetConfirm.ts | 10 + .../public/models/passwordResetRequest.ts | 10 + .../public/models/patchedCategory.ts | 20 + .../public/models/patchedContactMe.ts | 13 + .../public/models/patchedCustomUser.ts | 45 + .../public/models/patchedDiscountCode.ts | 39 + .../public/models/patchedOrderRead.ts | 34 + .../generated/public/models/patchedProduct.ts | 39 + .../public/models/patchedProductImage.ts | 14 + .../generated/public/models/patchedRefund.ts | 15 + .../models/patchedSiteConfigurationAdmin.ts | 77 + ...tchedSiteConfigurationAdminOpeningHours.ts | 10 + .../src/api/generated/public/models/payer.ts | 14 + .../api/generated/public/models/payment.ts | 16 + .../generated/public/models/paymentBody.ts | 26 + .../generated/public/models/paymentCreate.ts | 11 + .../public/models/paymentMethodEnum.ts | 20 + .../generated/public/models/paymentRead.ts | 10 + .../api/generated/public/models/product.ts | 39 + .../generated/public/models/productImage.ts | 14 + .../generated/public/models/productMini.ts | 13 + .../public/models/reasonChoiceEnum.ts | 22 + .../src/api/generated/public/models/refund.ts | 15 + .../api/generated/public/models/roleEnum.ts | 19 + .../public/models/shippingMethodEnum.ts | 18 + .../public/models/siteConfigurationAdmin.ts | 77 + .../siteConfigurationAdminOpeningHours.ts | 10 + .../public/models/siteConfigurationPublic.ts | 56 + .../siteConfigurationPublicOpeningHours.ts | 10 + .../generated/public/models/stateE15Enum.ts | 27 + .../generated/public/models/stateFdaEnum.ts | 21 + .../api/generated/public/models/statusEnum.ts | 23 + .../generated/public/models/trackingURL.ts | 10 + .../public/models/userRegistration.ts | 53 + .../public/models/videoInfoResponse.ts | 15 + .../public/models/zasilkovnaPacket.ts | 32 + .../public/models/zasilkovnaPacketRead.ts | 32 + .../zasilkovnaPacketReadReturnRouting.ts | 11 + .../models/zasilkovnaPacketReturnRouting.ts | 11 + .../public/models/zasilkovnaShipment.ts | 15 + frontend/src/api/generated/public/public.ts | 179 + frontend/src/orval.config.ts | 30 +- frontend/src/pages/downloader/Downloader.tsx | 58 +- frontend/tsconfig.app.json | 8 +- frontend/vite.config.ts | 6 + 203 files changed, 21447 insertions(+), 22 deletions(-) create mode 100644 frontend/src/api/README.md create mode 100644 frontend/src/api/generated/private/api/api.ts create mode 100644 frontend/src/api/generated/private/categories/categories.ts create mode 100644 frontend/src/api/generated/private/discount-codes/discount-codes.ts delete mode 100644 frontend/src/api/generated/private/filler create mode 100644 frontend/src/api/generated/private/go-pay/go-pay.ts create mode 100644 frontend/src/api/generated/private/models/additionalParam.ts create mode 100644 frontend/src/api/generated/private/models/apiAccountUsersListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiAdvertisementContactMessagesListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiCommerceCategoriesListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiCommerceDiscountCodesListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiCommerceOrdersListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiCommerceProductImagesListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiCommerceProductsListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiCommerceRefundsListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiConfigurationAdminShopConfigurationListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiConfigurationPublicShopConfigurationListParams.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieve200Four.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieve200One.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieve200Three.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieve200Two.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieveFormat.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieveLang.ts create mode 100644 frontend/src/api/generated/private/models/apiSchemaRetrieveParams.ts create mode 100644 frontend/src/api/generated/private/models/apiZasilkovnaShipmentsListParams.ts create mode 100644 frontend/src/api/generated/private/models/callback.ts create mode 100644 frontend/src/api/generated/private/models/carrierRead.ts create mode 100644 frontend/src/api/generated/private/models/category.ts create mode 100644 frontend/src/api/generated/private/models/contact.ts create mode 100644 frontend/src/api/generated/private/models/contactMe.ts create mode 100644 frontend/src/api/generated/private/models/currencyEnum.ts create mode 100644 frontend/src/api/generated/private/models/customTokenObtainPair.ts create mode 100644 frontend/src/api/generated/private/models/customUser.ts create mode 100644 frontend/src/api/generated/private/models/discountCode.ts create mode 100644 frontend/src/api/generated/private/models/downloadErrorResponse.ts create mode 100644 frontend/src/api/generated/private/models/downloadRequest.ts create mode 100644 frontend/src/api/generated/private/models/downloaderStats.ts create mode 100644 frontend/src/api/generated/private/models/errorResponse.ts create mode 100644 frontend/src/api/generated/private/models/extEnum.ts create mode 100644 frontend/src/api/generated/private/models/formatEnum.ts create mode 100644 frontend/src/api/generated/private/models/gopayCreatePayment201.ts create mode 100644 frontend/src/api/generated/private/models/gopayGetStatus200.ts create mode 100644 frontend/src/api/generated/private/models/gopayRefundPayment200.ts create mode 100644 frontend/src/api/generated/private/models/index.ts create mode 100644 frontend/src/api/generated/private/models/item.ts create mode 100644 frontend/src/api/generated/private/models/orderCarrier.ts create mode 100644 frontend/src/api/generated/private/models/orderCreate.ts create mode 100644 frontend/src/api/generated/private/models/orderItemCreate.ts create mode 100644 frontend/src/api/generated/private/models/orderItemRead.ts create mode 100644 frontend/src/api/generated/private/models/orderMini.ts create mode 100644 frontend/src/api/generated/private/models/orderRead.ts create mode 100644 frontend/src/api/generated/private/models/paginatedCategoryList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedContactMeList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedCustomUserList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedDiscountCodeList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedOrderReadList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedProductImageList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedProductList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedRefundList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedSiteConfigurationAdminList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedSiteConfigurationPublicList.ts create mode 100644 frontend/src/api/generated/private/models/paginatedZasilkovnaShipmentList.ts create mode 100644 frontend/src/api/generated/private/models/passwordResetConfirm.ts create mode 100644 frontend/src/api/generated/private/models/passwordResetRequest.ts create mode 100644 frontend/src/api/generated/private/models/patchedCategory.ts create mode 100644 frontend/src/api/generated/private/models/patchedContactMe.ts create mode 100644 frontend/src/api/generated/private/models/patchedCustomUser.ts create mode 100644 frontend/src/api/generated/private/models/patchedDiscountCode.ts create mode 100644 frontend/src/api/generated/private/models/patchedOrderRead.ts create mode 100644 frontend/src/api/generated/private/models/patchedProduct.ts create mode 100644 frontend/src/api/generated/private/models/patchedProductImage.ts create mode 100644 frontend/src/api/generated/private/models/patchedRefund.ts create mode 100644 frontend/src/api/generated/private/models/patchedSiteConfigurationAdmin.ts create mode 100644 frontend/src/api/generated/private/models/patchedSiteConfigurationAdminOpeningHours.ts create mode 100644 frontend/src/api/generated/private/models/payer.ts create mode 100644 frontend/src/api/generated/private/models/payment.ts create mode 100644 frontend/src/api/generated/private/models/paymentBody.ts create mode 100644 frontend/src/api/generated/private/models/paymentCreate.ts create mode 100644 frontend/src/api/generated/private/models/paymentMethodEnum.ts create mode 100644 frontend/src/api/generated/private/models/paymentRead.ts create mode 100644 frontend/src/api/generated/private/models/product.ts create mode 100644 frontend/src/api/generated/private/models/productImage.ts create mode 100644 frontend/src/api/generated/private/models/productMini.ts create mode 100644 frontend/src/api/generated/private/models/reasonChoiceEnum.ts create mode 100644 frontend/src/api/generated/private/models/refund.ts create mode 100644 frontend/src/api/generated/private/models/roleEnum.ts create mode 100644 frontend/src/api/generated/private/models/shippingMethodEnum.ts create mode 100644 frontend/src/api/generated/private/models/siteConfigurationAdmin.ts create mode 100644 frontend/src/api/generated/private/models/siteConfigurationAdminOpeningHours.ts create mode 100644 frontend/src/api/generated/private/models/siteConfigurationPublic.ts create mode 100644 frontend/src/api/generated/private/models/siteConfigurationPublicOpeningHours.ts create mode 100644 frontend/src/api/generated/private/models/stateE15Enum.ts create mode 100644 frontend/src/api/generated/private/models/stateFdaEnum.ts create mode 100644 frontend/src/api/generated/private/models/statusEnum.ts create mode 100644 frontend/src/api/generated/private/models/trackingURL.ts create mode 100644 frontend/src/api/generated/private/models/userRegistration.ts create mode 100644 frontend/src/api/generated/private/models/videoInfoResponse.ts create mode 100644 frontend/src/api/generated/private/models/zasilkovnaPacket.ts create mode 100644 frontend/src/api/generated/private/models/zasilkovnaPacketRead.ts create mode 100644 frontend/src/api/generated/private/models/zasilkovnaPacketReadReturnRouting.ts create mode 100644 frontend/src/api/generated/private/models/zasilkovnaPacketReturnRouting.ts create mode 100644 frontend/src/api/generated/private/models/zasilkovnaShipment.ts create mode 100644 frontend/src/api/generated/private/order/order.ts create mode 100644 frontend/src/api/generated/private/orders/orders.ts create mode 100644 frontend/src/api/generated/private/packet/packet.ts create mode 100644 frontend/src/api/generated/private/packeta-shipment/packeta-shipment.ts create mode 100644 frontend/src/api/generated/private/product-images/product-images.ts create mode 100644 frontend/src/api/generated/private/products/products.ts create mode 100644 frontend/src/api/generated/private/refunds/refunds.ts create mode 100644 frontend/src/api/generated/private/stripe/stripe.ts create mode 100644 frontend/src/api/generated/private/trading212/trading212.ts create mode 100644 frontend/src/api/generated/private/user-password-reset/user-password-reset.ts create mode 100644 frontend/src/api/generated/private/user-registration/user-registration.ts create mode 100644 frontend/src/api/generated/private/user/user.ts create mode 100644 frontend/src/api/generated/public/authentication.ts create mode 100644 frontend/src/api/generated/public/downloader.ts delete mode 100644 frontend/src/api/generated/public/filler create mode 100644 frontend/src/api/generated/public/models/additionalParam.ts create mode 100644 frontend/src/api/generated/public/models/apiChoicesRetrieve200.ts create mode 100644 frontend/src/api/generated/public/models/apiChoicesRetrieve200Item.ts create mode 100644 frontend/src/api/generated/public/models/apiChoicesRetrieveParams.ts create mode 100644 frontend/src/api/generated/public/models/apiDownloaderDownloadRetrieveParams.ts create mode 100644 frontend/src/api/generated/public/models/callback.ts create mode 100644 frontend/src/api/generated/public/models/carrierRead.ts create mode 100644 frontend/src/api/generated/public/models/category.ts create mode 100644 frontend/src/api/generated/public/models/contact.ts create mode 100644 frontend/src/api/generated/public/models/contactMe.ts create mode 100644 frontend/src/api/generated/public/models/currencyEnum.ts create mode 100644 frontend/src/api/generated/public/models/customTokenObtainPair.ts create mode 100644 frontend/src/api/generated/public/models/customUser.ts create mode 100644 frontend/src/api/generated/public/models/discountCode.ts create mode 100644 frontend/src/api/generated/public/models/downloadErrorResponse.ts create mode 100644 frontend/src/api/generated/public/models/downloadRequest.ts create mode 100644 frontend/src/api/generated/public/models/downloaderStats.ts create mode 100644 frontend/src/api/generated/public/models/errorResponse.ts create mode 100644 frontend/src/api/generated/public/models/extEnum.ts create mode 100644 frontend/src/api/generated/public/models/formatEnum.ts create mode 100644 frontend/src/api/generated/public/models/index.ts create mode 100644 frontend/src/api/generated/public/models/item.ts create mode 100644 frontend/src/api/generated/public/models/orderCarrier.ts create mode 100644 frontend/src/api/generated/public/models/orderCreate.ts create mode 100644 frontend/src/api/generated/public/models/orderItemCreate.ts create mode 100644 frontend/src/api/generated/public/models/orderItemRead.ts create mode 100644 frontend/src/api/generated/public/models/orderMini.ts create mode 100644 frontend/src/api/generated/public/models/orderRead.ts create mode 100644 frontend/src/api/generated/public/models/paginatedCategoryList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedContactMeList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedCustomUserList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedDiscountCodeList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedOrderReadList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedProductImageList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedProductList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedRefundList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedSiteConfigurationAdminList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedSiteConfigurationPublicList.ts create mode 100644 frontend/src/api/generated/public/models/paginatedZasilkovnaShipmentList.ts create mode 100644 frontend/src/api/generated/public/models/passwordResetConfirm.ts create mode 100644 frontend/src/api/generated/public/models/passwordResetRequest.ts create mode 100644 frontend/src/api/generated/public/models/patchedCategory.ts create mode 100644 frontend/src/api/generated/public/models/patchedContactMe.ts create mode 100644 frontend/src/api/generated/public/models/patchedCustomUser.ts create mode 100644 frontend/src/api/generated/public/models/patchedDiscountCode.ts create mode 100644 frontend/src/api/generated/public/models/patchedOrderRead.ts create mode 100644 frontend/src/api/generated/public/models/patchedProduct.ts create mode 100644 frontend/src/api/generated/public/models/patchedProductImage.ts create mode 100644 frontend/src/api/generated/public/models/patchedRefund.ts create mode 100644 frontend/src/api/generated/public/models/patchedSiteConfigurationAdmin.ts create mode 100644 frontend/src/api/generated/public/models/patchedSiteConfigurationAdminOpeningHours.ts create mode 100644 frontend/src/api/generated/public/models/payer.ts create mode 100644 frontend/src/api/generated/public/models/payment.ts create mode 100644 frontend/src/api/generated/public/models/paymentBody.ts create mode 100644 frontend/src/api/generated/public/models/paymentCreate.ts create mode 100644 frontend/src/api/generated/public/models/paymentMethodEnum.ts create mode 100644 frontend/src/api/generated/public/models/paymentRead.ts create mode 100644 frontend/src/api/generated/public/models/product.ts create mode 100644 frontend/src/api/generated/public/models/productImage.ts create mode 100644 frontend/src/api/generated/public/models/productMini.ts create mode 100644 frontend/src/api/generated/public/models/reasonChoiceEnum.ts create mode 100644 frontend/src/api/generated/public/models/refund.ts create mode 100644 frontend/src/api/generated/public/models/roleEnum.ts create mode 100644 frontend/src/api/generated/public/models/shippingMethodEnum.ts create mode 100644 frontend/src/api/generated/public/models/siteConfigurationAdmin.ts create mode 100644 frontend/src/api/generated/public/models/siteConfigurationAdminOpeningHours.ts create mode 100644 frontend/src/api/generated/public/models/siteConfigurationPublic.ts create mode 100644 frontend/src/api/generated/public/models/siteConfigurationPublicOpeningHours.ts create mode 100644 frontend/src/api/generated/public/models/stateE15Enum.ts create mode 100644 frontend/src/api/generated/public/models/stateFdaEnum.ts create mode 100644 frontend/src/api/generated/public/models/statusEnum.ts create mode 100644 frontend/src/api/generated/public/models/trackingURL.ts create mode 100644 frontend/src/api/generated/public/models/userRegistration.ts create mode 100644 frontend/src/api/generated/public/models/videoInfoResponse.ts create mode 100644 frontend/src/api/generated/public/models/zasilkovnaPacket.ts create mode 100644 frontend/src/api/generated/public/models/zasilkovnaPacketRead.ts create mode 100644 frontend/src/api/generated/public/models/zasilkovnaPacketReadReturnRouting.ts create mode 100644 frontend/src/api/generated/public/models/zasilkovnaPacketReturnRouting.ts create mode 100644 frontend/src/api/generated/public/models/zasilkovnaShipment.ts create mode 100644 frontend/src/api/generated/public/public.ts diff --git a/backend/thirdparty/downloader/views.py b/backend/thirdparty/downloader/views.py index f99351d..b2ed952 100644 --- a/backend/thirdparty/downloader/views.py +++ b/backend/thirdparty/downloader/views.py @@ -50,11 +50,28 @@ class Downloader(APIView): @extend_schema( tags=["downloader", "public"], summary="Get video info from URL", + description=""" + Fetch detailed information about a video from supported platforms. + + **Supported platforms:** YouTube, TikTok, Vimeo, Twitter, Instagram, Facebook, Reddit, and many more. + + **Returns:** + - Video title, duration, and thumbnail + - Available video qualities/resolutions + - Available audio formats + + **Usage:** + ``` + GET /api/downloader/download/?url=https://youtube.com/watch?v=VIDEO_ID + ``` + """, parameters=[ inline_serializer( name="VideoInfoParams", fields={ - "url": serializers.URLField(help_text="Video URL to analyze"), + "url": serializers.URLField( + help_text="Video URL from YouTube, TikTok, Vimeo, etc. Must be a valid URL from a supported platform." + ), }, ) ], @@ -62,16 +79,22 @@ class Downloader(APIView): 200: inline_serializer( name="VideoInfoResponse", fields={ - "title": serializers.CharField(), - "duration": serializers.IntegerField(allow_null=True), - "thumbnail": serializers.URLField(allow_null=True), - "video_resolutions": serializers.ListField(child=serializers.CharField()), - "audio_resolutions": serializers.ListField(child=serializers.CharField()), + "title": serializers.CharField(help_text="Video title"), + "duration": serializers.IntegerField(allow_null=True, help_text="Video duration in seconds (null if unavailable)"), + "thumbnail": serializers.URLField(allow_null=True, help_text="URL to video thumbnail image"), + "video_resolutions": serializers.ListField( + child=serializers.CharField(), + help_text="List of available video quality options (e.g., '1080p', '720p', '480p')" + ), + "audio_resolutions": serializers.ListField( + child=serializers.CharField(), + help_text="List of available audio format options" + ), }, ), 400: inline_serializer( name="ErrorResponse", - fields={"error": serializers.CharField()}, + fields={"error": serializers.CharField(help_text="Error message describing what went wrong")}, ), }, ) diff --git a/frontend/Dockerfile.prod b/frontend/Dockerfile.prod index 90cdedf..feba5c3 100644 --- a/frontend/Dockerfile.prod +++ b/frontend/Dockerfile.prod @@ -6,6 +6,8 @@ COPY package*.json ./ RUN npm ci || npm install COPY . . ENV NODE_ENV=production +# Skip Orval - use pre-generated files committed to git +ENV SKIP_ORVAL=true RUN npm run build # Step 2: Nginx runtime diff --git a/frontend/src/api/README.md b/frontend/src/api/README.md new file mode 100644 index 0000000..c5d5dc2 --- /dev/null +++ b/frontend/src/api/README.md @@ -0,0 +1,105 @@ +# API Documentation + +## Quick Start + +All API hooks are available from `@/api`: + +```typescript +import { useApiCommerceOrdersList, OrderRead } from '@/api'; +``` + +## Navigation Tips + +### Finding Hooks + +**Pattern**: `useApi[Tag][Path][Method]` + +| What you want | Hook name | +|---------------|-----------| +| List orders | `useApiCommerceOrdersList` | +| Get order by ID | `useApiCommerceOrdersRetrieve` | +| Create order | `useApiCommerceOrdersCreate` | +| Update order | `useApiCommerceOrdersPartialUpdate` | +| Delete order | `useApiCommerceOrdersDestroy` | + +### VS Code Shortcuts + +- `Ctrl/Cmd + P` → Quick file search (type "commerce") +- `Ctrl/Cmd + Shift + O` → Symbol search (type "useApi") +- `F12` → Go to definition +- `Shift + F12` → Find all usages + +## Common Patterns + +### Query (GET) +```typescript +const { data, isLoading, error } = useApiCommerceOrdersList({ + page: 1, + limit: 10, +}); +``` + +### Mutation (POST/PUT/PATCH/DELETE) +```typescript +const mutation = useApiCommerceOrdersCreate({ + mutation: { + onSuccess: (data) => console.log('Created!', data), + onError: (error) => console.error('Failed:', error), + } +}); + +mutation.mutate({ data: orderData }); +``` + +### With Infinite Scroll +```typescript +const { + data, + fetchNextPage, + hasNextPage +} = useApiCommerceOrdersListInfinite({ + limit: 20, +}); +``` + +## File Organization + +``` +api/ +├── index.ts ← Import everything from here +├── publicClient.ts ← Public API client (no auth) +├── privateClient.ts ← Private API client (with auth) +└── generated/ + ├── public/ ← Public endpoints + │ ├── public.ts + │ └── models/ + └── private/ ← Private endpoints (organized by tag) + ├── account/account.ts + ├── commerce/commerce.ts + ├── downloader/downloader.ts + ├── gopay/gopay.ts + ├── stripe/stripe.ts + ├── trading212/trading212.ts + ├── zasilkovna/zasilkovna.ts + ├── core/core.ts + └── models/ ← Shared TypeScript types +``` + +## Tips + +1. **Use TypeScript autocomplete**: Type `useApi` and let IntelliSense show you options +2. **Hover for docs**: Hover over any hook to see endpoint details +3. **Check models folder**: All response types are in `models/` +4. **Use React Query DevTools**: Add `` to see cache state + +## Regenerating + +```bash +npm run api:gen +``` + +This will: +1. Fetch OpenAPI schema from backend +2. Generate TypeScript hooks +3. Format with Prettier +4. Update all types diff --git a/frontend/src/api/generated/private/api/api.ts b/frontend/src/api/generated/private/api/api.ts new file mode 100644 index 0000000..031645a --- /dev/null +++ b/frontend/src/api/generated/private/api/api.ts @@ -0,0 +1,5186 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiAdvertisementContactMessagesListParams, + ApiConfigurationAdminShopConfigurationListParams, + ApiConfigurationPublicShopConfigurationListParams, + ApiSchemaRetrieve200Four, + ApiSchemaRetrieve200One, + ApiSchemaRetrieve200Three, + ApiSchemaRetrieve200Two, + ApiSchemaRetrieveParams, + ContactMe, + OrderMini, + OrderRead, + PaginatedContactMeList, + PaginatedSiteConfigurationAdminList, + PaginatedSiteConfigurationPublicList, + PatchedContactMe, + PatchedOrderRead, + PatchedSiteConfigurationAdmin, + SiteConfigurationAdmin, + SiteConfigurationPublic, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +export const apiAdvertisementContactMeCreate = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/advertisement/contact-me/`, + method: "POST", + signal, + }); +}; + +export const getApiAdvertisementContactMeCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const mutationKey = ["apiAdvertisementContactMeCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return apiAdvertisementContactMeCreate(); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAdvertisementContactMeCreateMutationResult = NonNullable< + Awaited> +>; + +export type ApiAdvertisementContactMeCreateMutationError = unknown; + +export const useApiAdvertisementContactMeCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + void, + TContext +> => { + const mutationOptions = + getApiAdvertisementContactMeCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiAdvertisementContactMessagesList = ( + params?: ApiAdvertisementContactMessagesListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/advertisement/contact-messages/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiAdvertisementContactMessagesListInfiniteQueryKey = ( + params?: ApiAdvertisementContactMessagesListParams, +) => { + return [ + "infinite", + `/api/advertisement/contact-messages/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiAdvertisementContactMessagesListQueryKey = ( + params?: ApiAdvertisementContactMessagesListParams, +) => { + return [ + `/api/advertisement/contact-messages/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiAdvertisementContactMessagesListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiAdvertisementContactMessagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiAdvertisementContactMessagesListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > = ({ signal, pageParam }) => + apiAdvertisementContactMessagesList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiAdvertisementContactMessagesListInfiniteQueryResult = + NonNullable>>; +export type ApiAdvertisementContactMessagesListInfiniteQueryError = unknown; + +export function useApiAdvertisementContactMessagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiAdvertisementContactMessagesListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiAdvertisementContactMessagesListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiAdvertisementContactMessagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiAdvertisementContactMessagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiAdvertisementContactMessagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiAdvertisementContactMessagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAdvertisementContactMessagesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiAdvertisementContactMessagesListInfiniteQueryOptions(params, options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiAdvertisementContactMessagesListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiAdvertisementContactMessagesListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAdvertisementContactMessagesList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAdvertisementContactMessagesListQueryResult = NonNullable< + Awaited> +>; +export type ApiAdvertisementContactMessagesListQueryError = unknown; + +export function useApiAdvertisementContactMessagesList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiAdvertisementContactMessagesListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiAdvertisementContactMessagesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiAdvertisementContactMessagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAdvertisementContactMessagesListQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiAdvertisementContactMessagesCreate = ( + contactMe: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/advertisement/contact-messages/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: contactMe, + signal, + }); +}; + +export const getApiAdvertisementContactMessagesCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiAdvertisementContactMessagesCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiAdvertisementContactMessagesCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAdvertisementContactMessagesCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiAdvertisementContactMessagesCreateMutationBody = + NonReadonly; +export type ApiAdvertisementContactMessagesCreateMutationError = unknown; + +export const useApiAdvertisementContactMessagesCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiAdvertisementContactMessagesCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiAdvertisementContactMessagesRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/advertisement/contact-messages/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiAdvertisementContactMessagesRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/advertisement/contact-messages/${id}/`] as const; +}; + +export const getApiAdvertisementContactMessagesRetrieveQueryKey = ( + id?: number, +) => { + return [`/api/advertisement/contact-messages/${id}/`] as const; +}; + +export const getApiAdvertisementContactMessagesRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiAdvertisementContactMessagesRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAdvertisementContactMessagesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAdvertisementContactMessagesRetrieveInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiAdvertisementContactMessagesRetrieveInfiniteQueryError = unknown; + +export function useApiAdvertisementContactMessagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiAdvertisementContactMessagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiAdvertisementContactMessagesRetrieveInfiniteQueryOptions(id, options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiAdvertisementContactMessagesRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiAdvertisementContactMessagesRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAdvertisementContactMessagesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAdvertisementContactMessagesRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiAdvertisementContactMessagesRetrieveQueryError = unknown; + +export function useApiAdvertisementContactMessagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiAdvertisementContactMessagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiAdvertisementContactMessagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAdvertisementContactMessagesRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiAdvertisementContactMessagesUpdate = ( + id: number, + contactMe: NonReadonly, +) => { + return privateMutator({ + url: `/api/advertisement/contact-messages/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: contactMe, + }); +}; + +export const getApiAdvertisementContactMessagesUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiAdvertisementContactMessagesUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiAdvertisementContactMessagesUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAdvertisementContactMessagesUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiAdvertisementContactMessagesUpdateMutationBody = + NonReadonly; +export type ApiAdvertisementContactMessagesUpdateMutationError = unknown; + +export const useApiAdvertisementContactMessagesUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiAdvertisementContactMessagesUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiAdvertisementContactMessagesPartialUpdate = ( + id: number, + patchedContactMe: NonReadonly, +) => { + return privateMutator({ + url: `/api/advertisement/contact-messages/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedContactMe, + }); +}; + +export const getApiAdvertisementContactMessagesPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiAdvertisementContactMessagesPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiAdvertisementContactMessagesPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAdvertisementContactMessagesPartialUpdateMutationResult = + NonNullable< + Awaited> + >; +export type ApiAdvertisementContactMessagesPartialUpdateMutationBody = + NonReadonly; +export type ApiAdvertisementContactMessagesPartialUpdateMutationError = unknown; + +export const useApiAdvertisementContactMessagesPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiAdvertisementContactMessagesPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiAdvertisementContactMessagesDestroy = (id: number) => { + return privateMutator({ + url: `/api/advertisement/contact-messages/${id}/`, + method: "DELETE", + }); +}; + +export const getApiAdvertisementContactMessagesDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiAdvertisementContactMessagesDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiAdvertisementContactMessagesDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAdvertisementContactMessagesDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiAdvertisementContactMessagesDestroyMutationError = unknown; + +export const useApiAdvertisementContactMessagesDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiAdvertisementContactMessagesDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiCommerceOrdersCarrierRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/orders/${id}/carrier/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceOrdersCarrierRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/commerce/orders/${id}/carrier/`] as const; +}; + +export const getApiCommerceOrdersCarrierRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/orders/${id}/carrier/`] as const; +}; + +export const getApiCommerceOrdersCarrierRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceOrdersCarrierRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersCarrierRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersCarrierRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersCarrierRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceOrdersCarrierRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersCarrierRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersCarrierRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersCarrierRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersCarrierRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceOrdersCarrierRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersCarrierRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersCarrierRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersCarrierRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersCarrierRetrieveQueryError = unknown; + +export function useApiCommerceOrdersCarrierRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersCarrierRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersCarrierRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersCarrierRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersCarrierRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiCommerceOrdersCarrierReadyToPickupPartialUpdate = ( + id: number, + patchedOrderRead: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/orders/${id}/carrier/ready-to-pickup/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedOrderRead, + }); +}; + +export const getApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }): UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext + > => { + const mutationKey = ["apiCommerceOrdersCarrierReadyToPickupPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType + >, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceOrdersCarrierReadyToPickupPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type ApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationResult = + NonNullable< + Awaited< + ReturnType + > + >; +export type ApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationError = + unknown; + +export const useApiCommerceOrdersCarrierReadyToPickupPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationOptions( + options, + ); + + return useMutation(mutationOptions, queryClient); +}; +export const apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate = ( + id: number, + patchedOrderRead: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/orders/${id}/carrier/start-ordering-shipping/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedOrderRead, + }); +}; + +export const getApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate + > + >, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }): UseMutationOptions< + Awaited< + ReturnType< + typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate + > + >, + TError, + { id: number; data: NonReadonly }, + TContext + > => { + const mutationKey = [ + "apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate", + ]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType< + typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate + > + >, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate( + id, + data, + ); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type ApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationResult = + NonNullable< + Awaited< + ReturnType< + typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate + > + > + >; +export type ApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationError = + unknown; + +export const useApiCommerceOrdersCarrierStartOrderingShippingPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType< + typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate + > + >, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType< + typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate + > + >, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationOptions( + options, + ); + + return useMutation(mutationOptions, queryClient); +}; +export const apiCommerceOrdersItemsRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/orders/${id}/items/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceOrdersItemsRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/commerce/orders/${id}/items/`] as const; +}; + +export const getApiCommerceOrdersItemsRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/orders/${id}/items/`] as const; +}; + +export const getApiCommerceOrdersItemsRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceOrdersItemsRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersItemsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersItemsRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersItemsRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceOrdersItemsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersItemsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersItemsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersItemsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersItemsRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceOrdersItemsRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersItemsRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersItemsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersItemsRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersItemsRetrieveQueryError = unknown; + +export function useApiCommerceOrdersItemsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersItemsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersItemsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersItemsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersItemsRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiCommerceOrdersPaymentRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/orders/${id}/payment/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceOrdersPaymentRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/commerce/orders/${id}/payment/`] as const; +}; + +export const getApiCommerceOrdersPaymentRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/orders/${id}/payment/`] as const; +}; + +export const getApiCommerceOrdersPaymentRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceOrdersPaymentRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersPaymentRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersPaymentRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersPaymentRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceOrdersPaymentRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersPaymentRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersPaymentRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersPaymentRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersPaymentRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceOrdersPaymentRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersPaymentRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersPaymentRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersPaymentRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersPaymentRetrieveQueryError = unknown; + +export function useApiCommerceOrdersPaymentRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersPaymentRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersPaymentRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersPaymentRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersPaymentRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiCommerceOrdersDetailRetrieve = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/commerce/orders/detail/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceOrdersDetailRetrieveInfiniteQueryKey = () => { + return ["infinite", `/api/commerce/orders/detail/`] as const; +}; + +export const getApiCommerceOrdersDetailRetrieveQueryKey = () => { + return [`/api/commerce/orders/detail/`] as const; +}; + +export const getApiCommerceOrdersDetailRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>(options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceOrdersDetailRetrieveInfiniteQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersDetailRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersDetailRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersDetailRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceOrdersDetailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersDetailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersDetailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersDetailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiCommerceOrdersDetailRetrieveInfiniteQueryOptions(options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceOrdersDetailRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersDetailRetrieveQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersDetailRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersDetailRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersDetailRetrieveQueryError = unknown; + +export function useApiCommerceOrdersDetailRetrieve< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersDetailRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersDetailRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceOrdersDetailRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersDetailRetrieveQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Public endpoint to create and fetch refund objects. + +POST: Create a refund given email and invoice_number or order_id. + Returns JSON with refund info, order items, and a base64 PDF payload. +GET: Return a refund object by id (query param `id`). + */ +export const apiCommerceRefundsPublicRetrieve = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/commerce/refunds/public/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceRefundsPublicRetrieveInfiniteQueryKey = () => { + return ["infinite", `/api/commerce/refunds/public/`] as const; +}; + +export const getApiCommerceRefundsPublicRetrieveQueryKey = () => { + return [`/api/commerce/refunds/public/`] as const; +}; + +export const getApiCommerceRefundsPublicRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>(options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceRefundsPublicRetrieveInfiniteQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceRefundsPublicRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceRefundsPublicRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsPublicRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceRefundsPublicRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsPublicRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsPublicRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceRefundsPublicRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiCommerceRefundsPublicRetrieveInfiniteQueryOptions(options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceRefundsPublicRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceRefundsPublicRetrieveQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceRefundsPublicRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceRefundsPublicRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsPublicRetrieveQueryError = unknown; + +export function useApiCommerceRefundsPublicRetrieve< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsPublicRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsPublicRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiCommerceRefundsPublicRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceRefundsPublicRetrieveQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Public endpoint to create and fetch refund objects. + +POST: Create a refund given email and invoice_number or order_id. + Returns JSON with refund info, order items, and a base64 PDF payload. +GET: Return a refund object by id (query param `id`). + */ +export const apiCommerceRefundsPublicCreate = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/commerce/refunds/public/`, + method: "POST", + signal, + }); +}; + +export const getApiCommerceRefundsPublicCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const mutationKey = ["apiCommerceRefundsPublicCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return apiCommerceRefundsPublicCreate(); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceRefundsPublicCreateMutationResult = NonNullable< + Awaited> +>; + +export type ApiCommerceRefundsPublicCreateMutationError = unknown; + +export const useApiCommerceRefundsPublicCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + void, + TContext +> => { + const mutationOptions = + getApiCommerceRefundsPublicCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiConfigurationAdminShopConfigurationList = ( + params?: ApiConfigurationAdminShopConfigurationListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/configuration/admin/shop-configuration/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiConfigurationAdminShopConfigurationListInfiniteQueryKey = ( + params?: ApiConfigurationAdminShopConfigurationListParams, +) => { + return [ + "infinite", + `/api/configuration/admin/shop-configuration/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiConfigurationAdminShopConfigurationListQueryKey = ( + params?: ApiConfigurationAdminShopConfigurationListParams, +) => { + return [ + `/api/configuration/admin/shop-configuration/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiConfigurationAdminShopConfigurationListInfiniteQueryOptions = + < + TData = InfiniteData< + Awaited>, + ApiConfigurationAdminShopConfigurationListParams["page"] + >, + TError = unknown, + >( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > + >; + }, + ) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationAdminShopConfigurationListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > = ({ signal, pageParam }) => + apiConfigurationAdminShopConfigurationList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > & { queryKey: DataTag }; + }; + +export type ApiConfigurationAdminShopConfigurationListInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationAdminShopConfigurationListInfiniteQueryError = + unknown; + +export function useApiConfigurationAdminShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationAdminShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiConfigurationAdminShopConfigurationListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + >, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationAdminShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + >, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationAdminShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationAdminShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationAdminShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationAdminShopConfigurationListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationAdminShopConfigurationListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiConfigurationAdminShopConfigurationListQueryOptions = < + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationAdminShopConfigurationListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + apiConfigurationAdminShopConfigurationList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiConfigurationAdminShopConfigurationListQueryResult = NonNullable< + Awaited> +>; +export type ApiConfigurationAdminShopConfigurationListQueryError = unknown; + +export function useApiConfigurationAdminShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params: undefined | ApiConfigurationAdminShopConfigurationListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationAdminShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationAdminShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationAdminShopConfigurationListQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiConfigurationAdminShopConfigurationCreate = ( + siteConfigurationAdmin: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/configuration/admin/shop-configuration/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: siteConfigurationAdmin, + signal, + }); +}; + +export const getApiConfigurationAdminShopConfigurationCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiConfigurationAdminShopConfigurationCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiConfigurationAdminShopConfigurationCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiConfigurationAdminShopConfigurationCreateMutationResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationAdminShopConfigurationCreateMutationBody = + NonReadonly; +export type ApiConfigurationAdminShopConfigurationCreateMutationError = unknown; + +export const useApiConfigurationAdminShopConfigurationCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiConfigurationAdminShopConfigurationCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiConfigurationAdminShopConfigurationRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/configuration/admin/shop-configuration/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiConfigurationAdminShopConfigurationRetrieveInfiniteQueryKey = + (id?: number) => { + return [ + "infinite", + `/api/configuration/admin/shop-configuration/${id}/`, + ] as const; + }; + +export const getApiConfigurationAdminShopConfigurationRetrieveQueryKey = ( + id?: number, +) => { + return [`/api/configuration/admin/shop-configuration/${id}/`] as const; +}; + +export const getApiConfigurationAdminShopConfigurationRetrieveInfiniteQueryOptions = + < + TData = InfiniteData< + Awaited> + >, + TError = unknown, + >( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + ) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationAdminShopConfigurationRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + apiConfigurationAdminShopConfigurationRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > & { queryKey: DataTag }; + }; + +export type ApiConfigurationAdminShopConfigurationRetrieveInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationAdminShopConfigurationRetrieveInfiniteQueryError = + unknown; + +export function useApiConfigurationAdminShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationAdminShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationAdminShopConfigurationRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiConfigurationAdminShopConfigurationRetrieveQueryOptions = < + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationAdminShopConfigurationRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + apiConfigurationAdminShopConfigurationRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiConfigurationAdminShopConfigurationRetrieveQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationAdminShopConfigurationRetrieveQueryError = unknown; + +export function useApiConfigurationAdminShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationAdminShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationAdminShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationAdminShopConfigurationRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiConfigurationAdminShopConfigurationUpdate = ( + id: number, + siteConfigurationAdmin: NonReadonly, +) => { + return privateMutator({ + url: `/api/configuration/admin/shop-configuration/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: siteConfigurationAdmin, + }); +}; + +export const getApiConfigurationAdminShopConfigurationUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiConfigurationAdminShopConfigurationUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiConfigurationAdminShopConfigurationUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiConfigurationAdminShopConfigurationUpdateMutationResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationAdminShopConfigurationUpdateMutationBody = + NonReadonly; +export type ApiConfigurationAdminShopConfigurationUpdateMutationError = unknown; + +export const useApiConfigurationAdminShopConfigurationUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiConfigurationAdminShopConfigurationUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiConfigurationAdminShopConfigurationPartialUpdate = ( + id: number, + patchedSiteConfigurationAdmin: NonReadonly, +) => { + return privateMutator({ + url: `/api/configuration/admin/shop-configuration/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedSiteConfigurationAdmin, + }); +}; + +export const getApiConfigurationAdminShopConfigurationPartialUpdateMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }): UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext + > => { + const mutationKey = ["apiConfigurationAdminShopConfigurationPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType + >, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiConfigurationAdminShopConfigurationPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type ApiConfigurationAdminShopConfigurationPartialUpdateMutationResult = + NonNullable< + Awaited< + ReturnType + > + >; +export type ApiConfigurationAdminShopConfigurationPartialUpdateMutationBody = + NonReadonly; +export type ApiConfigurationAdminShopConfigurationPartialUpdateMutationError = + unknown; + +export const useApiConfigurationAdminShopConfigurationPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited< + ReturnType + >, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiConfigurationAdminShopConfigurationPartialUpdateMutationOptions( + options, + ); + + return useMutation(mutationOptions, queryClient); +}; +export const apiConfigurationAdminShopConfigurationDestroy = (id: number) => { + return privateMutator({ + url: `/api/configuration/admin/shop-configuration/${id}/`, + method: "DELETE", + }); +}; + +export const getApiConfigurationAdminShopConfigurationDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiConfigurationAdminShopConfigurationDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiConfigurationAdminShopConfigurationDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiConfigurationAdminShopConfigurationDestroyMutationResult = + NonNullable< + Awaited> + >; + +export type ApiConfigurationAdminShopConfigurationDestroyMutationError = + unknown; + +export const useApiConfigurationAdminShopConfigurationDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiConfigurationAdminShopConfigurationDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +export const apiConfigurationPublicShopConfigurationList = ( + params?: ApiConfigurationPublicShopConfigurationListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/configuration/public/shop-configuration/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiConfigurationPublicShopConfigurationListInfiniteQueryKey = ( + params?: ApiConfigurationPublicShopConfigurationListParams, +) => { + return [ + "infinite", + `/api/configuration/public/shop-configuration/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiConfigurationPublicShopConfigurationListQueryKey = ( + params?: ApiConfigurationPublicShopConfigurationListParams, +) => { + return [ + `/api/configuration/public/shop-configuration/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiConfigurationPublicShopConfigurationListInfiniteQueryOptions = + < + TData = InfiniteData< + Awaited>, + ApiConfigurationPublicShopConfigurationListParams["page"] + >, + TError = unknown, + >( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > + >; + }, + ) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationPublicShopConfigurationListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > = ({ signal, pageParam }) => + apiConfigurationPublicShopConfigurationList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > & { queryKey: DataTag }; + }; + +export type ApiConfigurationPublicShopConfigurationListInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationPublicShopConfigurationListInfiniteQueryError = + unknown; + +export function useApiConfigurationPublicShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationPublicShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiConfigurationPublicShopConfigurationListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + >, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationPublicShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + >, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationPublicShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationPublicShopConfigurationListInfinite< + TData = InfiniteData< + Awaited>, + ApiConfigurationPublicShopConfigurationListParams["page"] + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiConfigurationPublicShopConfigurationListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationPublicShopConfigurationListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiConfigurationPublicShopConfigurationListQueryOptions = < + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationPublicShopConfigurationListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + apiConfigurationPublicShopConfigurationList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiConfigurationPublicShopConfigurationListQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationPublicShopConfigurationListQueryError = unknown; + +export function useApiConfigurationPublicShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params: undefined | ApiConfigurationPublicShopConfigurationListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationPublicShopConfigurationList< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + params?: ApiConfigurationPublicShopConfigurationListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationPublicShopConfigurationListQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const apiConfigurationPublicShopConfigurationRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/configuration/public/shop-configuration/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiConfigurationPublicShopConfigurationRetrieveInfiniteQueryKey = + (id?: number) => { + return [ + "infinite", + `/api/configuration/public/shop-configuration/${id}/`, + ] as const; + }; + +export const getApiConfigurationPublicShopConfigurationRetrieveQueryKey = ( + id?: number, +) => { + return [`/api/configuration/public/shop-configuration/${id}/`] as const; +}; + +export const getApiConfigurationPublicShopConfigurationRetrieveInfiniteQueryOptions = + < + TData = InfiniteData< + Awaited< + ReturnType + > + >, + TError = unknown, + >( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + ) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationPublicShopConfigurationRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited< + ReturnType + > + > = ({ signal }) => + apiConfigurationPublicShopConfigurationRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > & { queryKey: DataTag }; + }; + +export type ApiConfigurationPublicShopConfigurationRetrieveInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationPublicShopConfigurationRetrieveInfiniteQueryError = + unknown; + +export function useApiConfigurationPublicShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationPublicShopConfigurationRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationPublicShopConfigurationRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiConfigurationPublicShopConfigurationRetrieveQueryOptions = < + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiConfigurationPublicShopConfigurationRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + apiConfigurationPublicShopConfigurationRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiConfigurationPublicShopConfigurationRetrieveQueryResult = + NonNullable< + Awaited> + >; +export type ApiConfigurationPublicShopConfigurationRetrieveQueryError = unknown; + +export function useApiConfigurationPublicShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiConfigurationPublicShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiConfigurationPublicShopConfigurationRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiConfigurationPublicShopConfigurationRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * OpenApi3 schema for this API. Format can be selected via content negotiation. + +- YAML: application/vnd.oai.openapi +- JSON: application/vnd.oai.openapi+json + */ +export const apiSchemaRetrieve = ( + params?: ApiSchemaRetrieveParams, + signal?: AbortSignal, +) => { + return privateMutator< + | ApiSchemaRetrieve200One + | ApiSchemaRetrieve200Two + | ApiSchemaRetrieve200Three + | ApiSchemaRetrieve200Four + >({ url: `/api/schema/`, method: "GET", params, signal }); +}; + +export const getApiSchemaRetrieveInfiniteQueryKey = ( + params?: ApiSchemaRetrieveParams, +) => { + return ["infinite", `/api/schema/`, ...(params ? [params] : [])] as const; +}; + +export const getApiSchemaRetrieveQueryKey = ( + params?: ApiSchemaRetrieveParams, +) => { + return [`/api/schema/`, ...(params ? [params] : [])] as const; +}; + +export const getApiSchemaRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiSchemaRetrieveParams["page"] + >, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiSchemaRetrieveParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiSchemaRetrieveInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiSchemaRetrieveParams["page"] + > = ({ signal, pageParam }) => + apiSchemaRetrieve( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiSchemaRetrieveParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiSchemaRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiSchemaRetrieveInfiniteQueryError = unknown; + +export function useApiSchemaRetrieveInfinite< + TData = InfiniteData< + Awaited>, + ApiSchemaRetrieveParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiSchemaRetrieveParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiSchemaRetrieveParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiSchemaRetrieveInfinite< + TData = InfiniteData< + Awaited>, + ApiSchemaRetrieveParams["page"] + >, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiSchemaRetrieveParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiSchemaRetrieveInfinite< + TData = InfiniteData< + Awaited>, + ApiSchemaRetrieveParams["page"] + >, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiSchemaRetrieveParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; + +export function useApiSchemaRetrieveInfinite< + TData = InfiniteData< + Awaited>, + ApiSchemaRetrieveParams["page"] + >, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiSchemaRetrieveParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiSchemaRetrieveInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiSchemaRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiSchemaRetrieveQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiSchemaRetrieve(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiSchemaRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiSchemaRetrieveQueryError = unknown; + +export function useApiSchemaRetrieve< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiSchemaRetrieveParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiSchemaRetrieve< + TData = Awaited>, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiSchemaRetrieve< + TData = Awaited>, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiSchemaRetrieve< + TData = Awaited>, + TError = unknown, +>( + params?: ApiSchemaRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiSchemaRetrieveQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/private/categories/categories.ts b/frontend/src/api/generated/private/categories/categories.ts new file mode 100644 index 0000000..34335d3 --- /dev/null +++ b/frontend/src/api/generated/private/categories/categories.ts @@ -0,0 +1,1087 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiCommerceCategoriesListParams, + Category, + PaginatedCategoryList, + PatchedCategory, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * @summary List categories (public) + */ +export const apiCommerceCategoriesList = ( + params?: ApiCommerceCategoriesListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/categories/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiCommerceCategoriesListInfiniteQueryKey = ( + params?: ApiCommerceCategoriesListParams, +) => { + return [ + "infinite", + `/api/commerce/categories/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceCategoriesListQueryKey = ( + params?: ApiCommerceCategoriesListParams, +) => { + return [`/api/commerce/categories/`, ...(params ? [params] : [])] as const; +}; + +export const getApiCommerceCategoriesListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiCommerceCategoriesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceCategoriesListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > = ({ signal, pageParam }) => + apiCommerceCategoriesList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiCommerceCategoriesListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesListInfiniteQueryError = unknown; + +export function useApiCommerceCategoriesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceCategoriesListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiCommerceCategoriesListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceCategoriesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceCategoriesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List categories (public) + */ + +export function useApiCommerceCategoriesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceCategoriesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceCategoriesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceCategoriesListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceCategoriesListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceCategoriesListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceCategoriesList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceCategoriesListQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesListQueryError = unknown; + +export function useApiCommerceCategoriesList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiCommerceCategoriesListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List categories (public) + */ + +export function useApiCommerceCategoriesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceCategoriesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceCategoriesListQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Create category (auth required) + */ +export const apiCommerceCategoriesCreate = ( + category: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/categories/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: category, + signal, + }); +}; + +export const getApiCommerceCategoriesCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceCategoriesCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiCommerceCategoriesCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceCategoriesCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesCreateMutationBody = NonReadonly; +export type ApiCommerceCategoriesCreateMutationError = unknown; + +/** + * @summary Create category (auth required) + */ +export const useApiCommerceCategoriesCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceCategoriesCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Retrieve category (public) + */ +export const apiCommerceCategoriesRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/categories/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceCategoriesRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/commerce/categories/${id}/`] as const; +}; + +export const getApiCommerceCategoriesRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/categories/${id}/`] as const; +}; + +export const getApiCommerceCategoriesRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceCategoriesRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceCategoriesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceCategoriesRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceCategoriesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve category (public) + */ + +export function useApiCommerceCategoriesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceCategoriesRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceCategoriesRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceCategoriesRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceCategoriesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceCategoriesRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesRetrieveQueryError = unknown; + +export function useApiCommerceCategoriesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceCategoriesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve category (public) + */ + +export function useApiCommerceCategoriesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceCategoriesRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Replace category (auth required) + */ +export const apiCommerceCategoriesUpdate = ( + id: number, + category: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/categories/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: category, + }); +}; + +export const getApiCommerceCategoriesUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceCategoriesUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceCategoriesUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceCategoriesUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesUpdateMutationBody = NonReadonly; +export type ApiCommerceCategoriesUpdateMutationError = unknown; + +/** + * @summary Replace category (auth required) + */ +export const useApiCommerceCategoriesUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceCategoriesUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Update category (auth required) + */ +export const apiCommerceCategoriesPartialUpdate = ( + id: number, + patchedCategory: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/categories/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedCategory, + }); +}; + +export const getApiCommerceCategoriesPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceCategoriesPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceCategoriesPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceCategoriesPartialUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceCategoriesPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceCategoriesPartialUpdateMutationError = unknown; + +/** + * @summary Update category (auth required) + */ +export const useApiCommerceCategoriesPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceCategoriesPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Delete category (auth required) + */ +export const apiCommerceCategoriesDestroy = (id: number) => { + return privateMutator({ + url: `/api/commerce/categories/${id}/`, + method: "DELETE", + }); +}; + +export const getApiCommerceCategoriesDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiCommerceCategoriesDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiCommerceCategoriesDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceCategoriesDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiCommerceCategoriesDestroyMutationError = unknown; + +/** + * @summary Delete category (auth required) + */ +export const useApiCommerceCategoriesDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiCommerceCategoriesDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/discount-codes/discount-codes.ts b/frontend/src/api/generated/private/discount-codes/discount-codes.ts new file mode 100644 index 0000000..dbf2140 --- /dev/null +++ b/frontend/src/api/generated/private/discount-codes/discount-codes.ts @@ -0,0 +1,1092 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiCommerceDiscountCodesListParams, + DiscountCode, + PaginatedDiscountCodeList, + PatchedDiscountCode, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * @summary List discount codes (public) + */ +export const apiCommerceDiscountCodesList = ( + params?: ApiCommerceDiscountCodesListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/discount-codes/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiCommerceDiscountCodesListInfiniteQueryKey = ( + params?: ApiCommerceDiscountCodesListParams, +) => { + return [ + "infinite", + `/api/commerce/discount-codes/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceDiscountCodesListQueryKey = ( + params?: ApiCommerceDiscountCodesListParams, +) => { + return [ + `/api/commerce/discount-codes/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceDiscountCodesListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiCommerceDiscountCodesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceDiscountCodesListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > = ({ signal, pageParam }) => + apiCommerceDiscountCodesList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiCommerceDiscountCodesListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesListInfiniteQueryError = unknown; + +export function useApiCommerceDiscountCodesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceDiscountCodesListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiCommerceDiscountCodesListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceDiscountCodesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceDiscountCodesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List discount codes (public) + */ + +export function useApiCommerceDiscountCodesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceDiscountCodesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceDiscountCodesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceDiscountCodesListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceDiscountCodesListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceDiscountCodesListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceDiscountCodesList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceDiscountCodesListQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesListQueryError = unknown; + +export function useApiCommerceDiscountCodesList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiCommerceDiscountCodesListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List discount codes (public) + */ + +export function useApiCommerceDiscountCodesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceDiscountCodesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceDiscountCodesListQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Create discount code (auth required) + */ +export const apiCommerceDiscountCodesCreate = ( + discountCode: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/discount-codes/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: discountCode, + signal, + }); +}; + +export const getApiCommerceDiscountCodesCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceDiscountCodesCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiCommerceDiscountCodesCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceDiscountCodesCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesCreateMutationBody = + NonReadonly; +export type ApiCommerceDiscountCodesCreateMutationError = unknown; + +/** + * @summary Create discount code (auth required) + */ +export const useApiCommerceDiscountCodesCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceDiscountCodesCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Retrieve discount code (public) + */ +export const apiCommerceDiscountCodesRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/discount-codes/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceDiscountCodesRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/commerce/discount-codes/${id}/`] as const; +}; + +export const getApiCommerceDiscountCodesRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/discount-codes/${id}/`] as const; +}; + +export const getApiCommerceDiscountCodesRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceDiscountCodesRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceDiscountCodesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceDiscountCodesRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceDiscountCodesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve discount code (public) + */ + +export function useApiCommerceDiscountCodesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceDiscountCodesRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceDiscountCodesRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceDiscountCodesRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceDiscountCodesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceDiscountCodesRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesRetrieveQueryError = unknown; + +export function useApiCommerceDiscountCodesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceDiscountCodesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve discount code (public) + */ + +export function useApiCommerceDiscountCodesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceDiscountCodesRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Replace discount code (auth required) + */ +export const apiCommerceDiscountCodesUpdate = ( + id: number, + discountCode: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/discount-codes/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: discountCode, + }); +}; + +export const getApiCommerceDiscountCodesUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceDiscountCodesUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceDiscountCodesUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceDiscountCodesUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesUpdateMutationBody = + NonReadonly; +export type ApiCommerceDiscountCodesUpdateMutationError = unknown; + +/** + * @summary Replace discount code (auth required) + */ +export const useApiCommerceDiscountCodesUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceDiscountCodesUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Update discount code (auth required) + */ +export const apiCommerceDiscountCodesPartialUpdate = ( + id: number, + patchedDiscountCode: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/discount-codes/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedDiscountCode, + }); +}; + +export const getApiCommerceDiscountCodesPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceDiscountCodesPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceDiscountCodesPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceDiscountCodesPartialUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceDiscountCodesPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceDiscountCodesPartialUpdateMutationError = unknown; + +/** + * @summary Update discount code (auth required) + */ +export const useApiCommerceDiscountCodesPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceDiscountCodesPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Delete discount code (auth required) + */ +export const apiCommerceDiscountCodesDestroy = (id: number) => { + return privateMutator({ + url: `/api/commerce/discount-codes/${id}/`, + method: "DELETE", + }); +}; + +export const getApiCommerceDiscountCodesDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiCommerceDiscountCodesDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiCommerceDiscountCodesDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceDiscountCodesDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiCommerceDiscountCodesDestroyMutationError = unknown; + +/** + * @summary Delete discount code (auth required) + */ +export const useApiCommerceDiscountCodesDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiCommerceDiscountCodesDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/filler b/frontend/src/api/generated/private/filler deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/api/generated/private/go-pay/go-pay.ts b/frontend/src/api/generated/private/go-pay/go-pay.ts new file mode 100644 index 0000000..31a77f3 --- /dev/null +++ b/frontend/src/api/generated/private/go-pay/go-pay.ts @@ -0,0 +1,525 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + GopayCreatePayment201, + GopayGetStatus200, + GopayRefundPayment200, + PaymentCreate, + Refund, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * Provede refundaci platby v GoPay a uloží záznam refundace. + * @summary Refundovat platbu + */ +export const gopayRefundPayment = ( + paymentId: string, + refund: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/payments/gopay/${paymentId}/refund/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: refund, + signal, + }); +}; + +export const getGopayRefundPaymentMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { paymentId: string; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { paymentId: string; data: NonReadonly }, + TContext +> => { + const mutationKey = ["gopayRefundPayment"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { paymentId: string; data: NonReadonly } + > = (props) => { + const { paymentId, data } = props ?? {}; + + return gopayRefundPayment(paymentId, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type GopayRefundPaymentMutationResult = NonNullable< + Awaited> +>; +export type GopayRefundPaymentMutationBody = NonReadonly; +export type GopayRefundPaymentMutationError = void; + +/** + * @summary Refundovat platbu + */ +export const useGopayRefundPayment = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { paymentId: string; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { paymentId: string; data: NonReadonly }, + TContext +> => { + const mutationOptions = getGopayRefundPaymentMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Načte aktuální stav platby GoPay a případně synchronizuje lokální záznam. + * @summary Získat stav platby + */ +export const gopayGetStatus = (paymentId: string, signal?: AbortSignal) => { + return privateMutator({ + url: `/api/payments/gopay/${paymentId}/status/`, + method: "GET", + signal, + }); +}; + +export const getGopayGetStatusInfiniteQueryKey = (paymentId?: string) => { + return ["infinite", `/api/payments/gopay/${paymentId}/status/`] as const; +}; + +export const getGopayGetStatusQueryKey = (paymentId?: string) => { + return [`/api/payments/gopay/${paymentId}/status/`] as const; +}; + +export const getGopayGetStatusInfiniteQueryOptions = < + TData = InfiniteData>>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getGopayGetStatusInfiniteQueryKey(paymentId); + + const queryFn: QueryFunction>> = ({ + signal, + }) => gopayGetStatus(paymentId, signal); + + return { + queryKey, + queryFn, + enabled: !!paymentId, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GopayGetStatusInfiniteQueryResult = NonNullable< + Awaited> +>; +export type GopayGetStatusInfiniteQueryError = void; + +export function useGopayGetStatusInfinite< + TData = InfiniteData>>, + TError = void, +>( + paymentId: string, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useGopayGetStatusInfinite< + TData = InfiniteData>>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useGopayGetStatusInfinite< + TData = InfiniteData>>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Získat stav platby + */ + +export function useGopayGetStatusInfinite< + TData = InfiniteData>>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getGopayGetStatusInfiniteQueryOptions( + paymentId, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getGopayGetStatusQueryOptions = < + TData = Awaited>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getGopayGetStatusQueryKey(paymentId); + + const queryFn: QueryFunction>> = ({ + signal, + }) => gopayGetStatus(paymentId, signal); + + return { + queryKey, + queryFn, + enabled: !!paymentId, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type GopayGetStatusQueryResult = NonNullable< + Awaited> +>; +export type GopayGetStatusQueryError = void; + +export function useGopayGetStatus< + TData = Awaited>, + TError = void, +>( + paymentId: string, + options: { + query: Partial< + UseQueryOptions>, TError, TData> + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useGopayGetStatus< + TData = Awaited>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useGopayGetStatus< + TData = Awaited>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Získat stav platby + */ + +export function useGopayGetStatus< + TData = Awaited>, + TError = void, +>( + paymentId: string, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getGopayGetStatusQueryOptions(paymentId, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Vytvoří platbu v GoPay s minimálními povinnými poli. Citlivé údaje o kartě se neposílají, platbu obslouží GoPay stránka (gw_url). Pokud není zadán notification_url, použije se hodnota ze settings.GOPAY_NOTIFICATION_URL. + * @summary Vytvořit platbu (minimální vstup) + */ +export const gopayCreatePayment = ( + paymentCreate: PaymentCreate, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/payments/gopay/create/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: paymentCreate, + signal, + }); +}; + +export const getGopayCreatePaymentMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: PaymentCreate }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: PaymentCreate }, + TContext +> => { + const mutationKey = ["gopayCreatePayment"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: PaymentCreate } + > = (props) => { + const { data } = props ?? {}; + + return gopayCreatePayment(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type GopayCreatePaymentMutationResult = NonNullable< + Awaited> +>; +export type GopayCreatePaymentMutationBody = PaymentCreate; +export type GopayCreatePaymentMutationError = void; + +/** + * @summary Vytvořit platbu (minimální vstup) + */ +export const useGopayCreatePayment = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: PaymentCreate }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: PaymentCreate }, + TContext +> => { + const mutationOptions = getGopayCreatePaymentMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/models/additionalParam.ts b/frontend/src/api/generated/private/models/additionalParam.ts new file mode 100644 index 0000000..e2a84cb --- /dev/null +++ b/frontend/src/api/generated/private/models/additionalParam.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface AdditionalParam { + name: string; + value: string; +} diff --git a/frontend/src/api/generated/private/models/apiAccountUsersListParams.ts b/frontend/src/api/generated/private/models/apiAccountUsersListParams.ts new file mode 100644 index 0000000..062ace0 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiAccountUsersListParams.ts @@ -0,0 +1,23 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiAccountUsersListParams = { + city?: string; + create_time_after?: Date; + create_time_before?: Date; + email?: string; + email_verified?: boolean; + gdpr?: boolean; + is_active?: boolean; + /** + * A page number within the paginated result set. + */ + page?: number; + phone_number?: string; + postal_code?: string; + role?: string; + street?: string; +}; diff --git a/frontend/src/api/generated/private/models/apiAdvertisementContactMessagesListParams.ts b/frontend/src/api/generated/private/models/apiAdvertisementContactMessagesListParams.ts new file mode 100644 index 0000000..4b5710b --- /dev/null +++ b/frontend/src/api/generated/private/models/apiAdvertisementContactMessagesListParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiAdvertisementContactMessagesListParams = { + /** + * A page number within the paginated result set. + */ + page?: number; +}; diff --git a/frontend/src/api/generated/private/models/apiCommerceCategoriesListParams.ts b/frontend/src/api/generated/private/models/apiCommerceCategoriesListParams.ts new file mode 100644 index 0000000..1382a47 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiCommerceCategoriesListParams.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiCommerceCategoriesListParams = { + /** + * Which field to use when ordering the results. + */ + ordering?: string; + /** + * A page number within the paginated result set. + */ + page?: number; + /** + * A search term. + */ + search?: string; +}; diff --git a/frontend/src/api/generated/private/models/apiCommerceDiscountCodesListParams.ts b/frontend/src/api/generated/private/models/apiCommerceDiscountCodesListParams.ts new file mode 100644 index 0000000..632d1f5 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiCommerceDiscountCodesListParams.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiCommerceDiscountCodesListParams = { + /** + * Which field to use when ordering the results. + */ + ordering?: string; + /** + * A page number within the paginated result set. + */ + page?: number; + /** + * A search term. + */ + search?: string; +}; diff --git a/frontend/src/api/generated/private/models/apiCommerceOrdersListParams.ts b/frontend/src/api/generated/private/models/apiCommerceOrdersListParams.ts new file mode 100644 index 0000000..6a7dbb3 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiCommerceOrdersListParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiCommerceOrdersListParams = { + /** + * A page number within the paginated result set. + */ + page?: number; +}; diff --git a/frontend/src/api/generated/private/models/apiCommerceProductImagesListParams.ts b/frontend/src/api/generated/private/models/apiCommerceProductImagesListParams.ts new file mode 100644 index 0000000..c3ad8ed --- /dev/null +++ b/frontend/src/api/generated/private/models/apiCommerceProductImagesListParams.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiCommerceProductImagesListParams = { + /** + * Which field to use when ordering the results. + */ + ordering?: string; + /** + * A page number within the paginated result set. + */ + page?: number; + /** + * A search term. + */ + search?: string; +}; diff --git a/frontend/src/api/generated/private/models/apiCommerceProductsListParams.ts b/frontend/src/api/generated/private/models/apiCommerceProductsListParams.ts new file mode 100644 index 0000000..431a4f4 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiCommerceProductsListParams.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiCommerceProductsListParams = { + /** + * Which field to use when ordering the results. + */ + ordering?: string; + /** + * A page number within the paginated result set. + */ + page?: number; + /** + * A search term. + */ + search?: string; +}; diff --git a/frontend/src/api/generated/private/models/apiCommerceRefundsListParams.ts b/frontend/src/api/generated/private/models/apiCommerceRefundsListParams.ts new file mode 100644 index 0000000..0eb79d0 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiCommerceRefundsListParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiCommerceRefundsListParams = { + /** + * A page number within the paginated result set. + */ + page?: number; +}; diff --git a/frontend/src/api/generated/private/models/apiConfigurationAdminShopConfigurationListParams.ts b/frontend/src/api/generated/private/models/apiConfigurationAdminShopConfigurationListParams.ts new file mode 100644 index 0000000..16711dd --- /dev/null +++ b/frontend/src/api/generated/private/models/apiConfigurationAdminShopConfigurationListParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiConfigurationAdminShopConfigurationListParams = { + /** + * A page number within the paginated result set. + */ + page?: number; +}; diff --git a/frontend/src/api/generated/private/models/apiConfigurationPublicShopConfigurationListParams.ts b/frontend/src/api/generated/private/models/apiConfigurationPublicShopConfigurationListParams.ts new file mode 100644 index 0000000..f05f0e5 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiConfigurationPublicShopConfigurationListParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiConfigurationPublicShopConfigurationListParams = { + /** + * A page number within the paginated result set. + */ + page?: number; +}; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieve200Four.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieve200Four.ts new file mode 100644 index 0000000..e7149a9 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieve200Four.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiSchemaRetrieve200Four = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieve200One.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieve200One.ts new file mode 100644 index 0000000..0649b79 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieve200One.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiSchemaRetrieve200One = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieve200Three.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieve200Three.ts new file mode 100644 index 0000000..b322b1e --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieve200Three.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiSchemaRetrieve200Three = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieve200Two.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieve200Two.ts new file mode 100644 index 0000000..fba4406 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieve200Two.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiSchemaRetrieve200Two = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieveFormat.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieveFormat.ts new file mode 100644 index 0000000..9213400 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieveFormat.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiSchemaRetrieveFormat = + (typeof ApiSchemaRetrieveFormat)[keyof typeof ApiSchemaRetrieveFormat]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ApiSchemaRetrieveFormat = { + json: "json", + yaml: "yaml", +} as const; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieveLang.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieveLang.ts new file mode 100644 index 0000000..3607bc5 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieveLang.ts @@ -0,0 +1,111 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiSchemaRetrieveLang = + (typeof ApiSchemaRetrieveLang)[keyof typeof ApiSchemaRetrieveLang]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ApiSchemaRetrieveLang = { + af: "af", + ar: "ar", + "ar-dz": "ar-dz", + ast: "ast", + az: "az", + be: "be", + bg: "bg", + bn: "bn", + br: "br", + bs: "bs", + ca: "ca", + ckb: "ckb", + cs: "cs", + cy: "cy", + da: "da", + de: "de", + dsb: "dsb", + el: "el", + en: "en", + "en-au": "en-au", + "en-gb": "en-gb", + eo: "eo", + es: "es", + "es-ar": "es-ar", + "es-co": "es-co", + "es-mx": "es-mx", + "es-ni": "es-ni", + "es-ve": "es-ve", + et: "et", + eu: "eu", + fa: "fa", + fi: "fi", + fr: "fr", + fy: "fy", + ga: "ga", + gd: "gd", + gl: "gl", + he: "he", + hi: "hi", + hr: "hr", + hsb: "hsb", + hu: "hu", + hy: "hy", + ia: "ia", + id: "id", + ig: "ig", + io: "io", + is: "is", + it: "it", + ja: "ja", + ka: "ka", + kab: "kab", + kk: "kk", + km: "km", + kn: "kn", + ko: "ko", + ky: "ky", + lb: "lb", + lt: "lt", + lv: "lv", + mk: "mk", + ml: "ml", + mn: "mn", + mr: "mr", + ms: "ms", + my: "my", + nb: "nb", + ne: "ne", + nl: "nl", + nn: "nn", + os: "os", + pa: "pa", + pl: "pl", + pt: "pt", + "pt-br": "pt-br", + ro: "ro", + ru: "ru", + sk: "sk", + sl: "sl", + sq: "sq", + sr: "sr", + "sr-latn": "sr-latn", + sv: "sv", + sw: "sw", + ta: "ta", + te: "te", + tg: "tg", + th: "th", + tk: "tk", + tr: "tr", + tt: "tt", + udm: "udm", + ug: "ug", + uk: "uk", + ur: "ur", + uz: "uz", + vi: "vi", + "zh-hans": "zh-hans", + "zh-hant": "zh-hant", +} as const; diff --git a/frontend/src/api/generated/private/models/apiSchemaRetrieveParams.ts b/frontend/src/api/generated/private/models/apiSchemaRetrieveParams.ts new file mode 100644 index 0000000..729826f --- /dev/null +++ b/frontend/src/api/generated/private/models/apiSchemaRetrieveParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ApiSchemaRetrieveFormat } from "./apiSchemaRetrieveFormat"; +import type { ApiSchemaRetrieveLang } from "./apiSchemaRetrieveLang"; + +export type ApiSchemaRetrieveParams = { + format?: ApiSchemaRetrieveFormat; + lang?: ApiSchemaRetrieveLang; +}; diff --git a/frontend/src/api/generated/private/models/apiZasilkovnaShipmentsListParams.ts b/frontend/src/api/generated/private/models/apiZasilkovnaShipmentsListParams.ts new file mode 100644 index 0000000..b9773e6 --- /dev/null +++ b/frontend/src/api/generated/private/models/apiZasilkovnaShipmentsListParams.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiZasilkovnaShipmentsListParams = { + /** + * A page number within the paginated result set. + */ + page?: number; +}; diff --git a/frontend/src/api/generated/private/models/callback.ts b/frontend/src/api/generated/private/models/callback.ts new file mode 100644 index 0000000..bbb23e9 --- /dev/null +++ b/frontend/src/api/generated/private/models/callback.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Callback { + return_url: string; + notification_url?: string; +} diff --git a/frontend/src/api/generated/private/models/carrierRead.ts b/frontend/src/api/generated/private/models/carrierRead.ts new file mode 100644 index 0000000..bd4227f --- /dev/null +++ b/frontend/src/api/generated/private/models/carrierRead.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ShippingMethodEnum } from "./shippingMethodEnum"; +import type { StateFdaEnum } from "./stateFdaEnum"; +import type { ZasilkovnaPacketRead } from "./zasilkovnaPacketRead"; + +export interface CarrierRead { + readonly shipping_method: ShippingMethodEnum; + readonly state: StateFdaEnum; + readonly zasilkovna: readonly ZasilkovnaPacketRead[]; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly shipping_price: string; +} diff --git a/frontend/src/api/generated/private/models/category.ts b/frontend/src/api/generated/private/models/category.ts new file mode 100644 index 0000000..a397395 --- /dev/null +++ b/frontend/src/api/generated/private/models/category.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Category { + readonly id: number; + /** @maxLength 100 */ + name: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url: string; + /** @nullable */ + parent?: number | null; + description?: string; + image?: string; +} diff --git a/frontend/src/api/generated/private/models/contact.ts b/frontend/src/api/generated/private/models/contact.ts new file mode 100644 index 0000000..016c510 --- /dev/null +++ b/frontend/src/api/generated/private/models/contact.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Contact { + email: string; + first_name?: string; + last_name?: string; + phone_number?: string; + city?: string; + street?: string; + postal_code?: string; + country_code?: string; +} diff --git a/frontend/src/api/generated/private/models/contactMe.ts b/frontend/src/api/generated/private/models/contactMe.ts new file mode 100644 index 0000000..8379b01 --- /dev/null +++ b/frontend/src/api/generated/private/models/contactMe.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ContactMe { + readonly id: number; + /** @maxLength 254 */ + client_email: string; + content: string; + readonly sent_at: Date; +} diff --git a/frontend/src/api/generated/private/models/currencyEnum.ts b/frontend/src/api/generated/private/models/currencyEnum.ts new file mode 100644 index 0000000..d0abaf1 --- /dev/null +++ b/frontend/src/api/generated/private/models/currencyEnum.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `CZK` - cz#Czech Koruna + * `EUR` - cz#Euro + */ +export type CurrencyEnum = (typeof CurrencyEnum)[keyof typeof CurrencyEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const CurrencyEnum = { + CZK: "CZK", + EUR: "EUR", +} as const; diff --git a/frontend/src/api/generated/private/models/customTokenObtainPair.ts b/frontend/src/api/generated/private/models/customTokenObtainPair.ts new file mode 100644 index 0000000..95a29ed --- /dev/null +++ b/frontend/src/api/generated/private/models/customTokenObtainPair.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface CustomTokenObtainPair { + username: string; + password: string; +} diff --git a/frontend/src/api/generated/private/models/customUser.ts b/frontend/src/api/generated/private/models/customUser.ts new file mode 100644 index 0000000..f48e6a2 --- /dev/null +++ b/frontend/src/api/generated/private/models/customUser.ts @@ -0,0 +1,45 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { RoleEnum } from "./roleEnum"; + +export interface CustomUser { + readonly id: number; + /** Požadováno. 150 znaků nebo méně. Pouze písmena, číslice a znaky @/./+/-/_. */ + readonly username: string; + /** @maxLength 150 */ + first_name?: string; + /** @maxLength 150 */ + last_name?: string; + /** @maxLength 254 */ + email: string; + role?: RoleEnum; + email_verified?: boolean; + /** + * @maxLength 16 + * @nullable + * @pattern ^\+?\d{9,15}$ + */ + phone_number?: string | null; + readonly create_time: Date; + /** + * @maxLength 100 + * @nullable + */ + city?: string | null; + /** + * @maxLength 200 + * @nullable + */ + street?: string | null; + /** + * @maxLength 5 + * @nullable + * @pattern ^\d{5}$ + */ + postal_code?: string | null; + readonly gdpr: boolean; + is_active?: boolean; +} diff --git a/frontend/src/api/generated/private/models/discountCode.ts b/frontend/src/api/generated/private/models/discountCode.ts new file mode 100644 index 0000000..298445a --- /dev/null +++ b/frontend/src/api/generated/private/models/discountCode.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface DiscountCode { + readonly id: number; + /** @maxLength 50 */ + code: string; + /** @maxLength 255 */ + description?: string; + /** + * Procento sleva 0-100 + * @minimum 0 + * @maximum 100 + * @nullable + */ + percent?: number | null; + /** + * Fixní sleva v CZK + * @nullable + * @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ + */ + amount?: string | null; + valid_from?: Date; + /** @nullable */ + valid_to?: Date | null; + active?: boolean; + /** + * @minimum 0 + * @maximum 9223372036854776000 + * @nullable + */ + usage_limit?: number | null; + readonly used_count: number; + specific_products?: number[]; + specific_categories?: number[]; +} diff --git a/frontend/src/api/generated/private/models/downloadErrorResponse.ts b/frontend/src/api/generated/private/models/downloadErrorResponse.ts new file mode 100644 index 0000000..036a310 --- /dev/null +++ b/frontend/src/api/generated/private/models/downloadErrorResponse.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface DownloadErrorResponse { + error: string; + allowed?: string[]; +} diff --git a/frontend/src/api/generated/private/models/downloadRequest.ts b/frontend/src/api/generated/private/models/downloadRequest.ts new file mode 100644 index 0000000..0193507 --- /dev/null +++ b/frontend/src/api/generated/private/models/downloadRequest.ts @@ -0,0 +1,36 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ExtEnum } from "./extEnum"; +import type { FormatEnum } from "./formatEnum"; + +export interface DownloadRequest { + /** Video URL to download */ + url: string; + /** Choose container format: mp4 (H.264 + AAC, most compatible), mkv (flexible, lossless container), webm (VP9/AV1 + Opus), flv (legacy), mov (Apple-friendly), avi (older), ogg (mostly obsolete). + +* `mp4` - mp4 +* `mkv` - mkv +* `webm` - webm +* `flv` - flv +* `mov` - mov +* `avi` - avi +* `ogg` - ogg */ + ext?: ExtEnum; + /** Alias of 'ext' (deprecated). + +* `mp4` - mp4 +* `mkv` - mkv +* `webm` - webm +* `flv` - flv +* `mov` - mov +* `avi` - avi +* `ogg` - ogg */ + format?: FormatEnum; + /** Target max video height (e.g. 1080). */ + video_quality: number; + /** Target max audio bitrate in kbps (e.g. 160). */ + audio_quality: number; +} diff --git a/frontend/src/api/generated/private/models/downloaderStats.ts b/frontend/src/api/generated/private/models/downloaderStats.ts new file mode 100644 index 0000000..28a7e0c --- /dev/null +++ b/frontend/src/api/generated/private/models/downloaderStats.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface DownloaderStats { + total_downloads: number; + /** @nullable */ + avg_length_of_media: number | null; + /** @nullable */ + avg_file_size: number | null; + /** @nullable */ + total_length_of_media: number | null; + /** @nullable */ + total_file_size: number | null; + /** @nullable */ + most_common_format: string | null; +} diff --git a/frontend/src/api/generated/private/models/errorResponse.ts b/frontend/src/api/generated/private/models/errorResponse.ts new file mode 100644 index 0000000..fc2b666 --- /dev/null +++ b/frontend/src/api/generated/private/models/errorResponse.ts @@ -0,0 +1,9 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ErrorResponse { + error: string; +} diff --git a/frontend/src/api/generated/private/models/extEnum.ts b/frontend/src/api/generated/private/models/extEnum.ts new file mode 100644 index 0000000..f4ed4f6 --- /dev/null +++ b/frontend/src/api/generated/private/models/extEnum.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `mp4` - mp4 + * `mkv` - mkv + * `webm` - webm + * `flv` - flv + * `mov` - mov + * `avi` - avi + * `ogg` - ogg + */ +export type ExtEnum = (typeof ExtEnum)[keyof typeof ExtEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ExtEnum = { + mp4: "mp4", + mkv: "mkv", + webm: "webm", + flv: "flv", + mov: "mov", + avi: "avi", + ogg: "ogg", +} as const; diff --git a/frontend/src/api/generated/private/models/formatEnum.ts b/frontend/src/api/generated/private/models/formatEnum.ts new file mode 100644 index 0000000..aefaf77 --- /dev/null +++ b/frontend/src/api/generated/private/models/formatEnum.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `mp4` - mp4 + * `mkv` - mkv + * `webm` - webm + * `flv` - flv + * `mov` - mov + * `avi` - avi + * `ogg` - ogg + */ +export type FormatEnum = (typeof FormatEnum)[keyof typeof FormatEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const FormatEnum = { + mp4: "mp4", + mkv: "mkv", + webm: "webm", + flv: "flv", + mov: "mov", + avi: "avi", + ogg: "ogg", +} as const; diff --git a/frontend/src/api/generated/private/models/gopayCreatePayment201.ts b/frontend/src/api/generated/private/models/gopayCreatePayment201.ts new file mode 100644 index 0000000..ab4c759 --- /dev/null +++ b/frontend/src/api/generated/private/models/gopayCreatePayment201.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type GopayCreatePayment201 = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/gopayGetStatus200.ts b/frontend/src/api/generated/private/models/gopayGetStatus200.ts new file mode 100644 index 0000000..bd24e17 --- /dev/null +++ b/frontend/src/api/generated/private/models/gopayGetStatus200.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type GopayGetStatus200 = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/gopayRefundPayment200.ts b/frontend/src/api/generated/private/models/gopayRefundPayment200.ts new file mode 100644 index 0000000..044c1ef --- /dev/null +++ b/frontend/src/api/generated/private/models/gopayRefundPayment200.ts @@ -0,0 +1,7 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type GopayRefundPayment200 = { [key: string]: unknown }; diff --git a/frontend/src/api/generated/private/models/index.ts b/frontend/src/api/generated/private/models/index.ts new file mode 100644 index 0000000..40bc7e3 --- /dev/null +++ b/frontend/src/api/generated/private/models/index.ts @@ -0,0 +1,101 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export * from "./additionalParam"; +export * from "./apiAccountUsersListParams"; +export * from "./apiAdvertisementContactMessagesListParams"; +export * from "./apiCommerceCategoriesListParams"; +export * from "./apiCommerceDiscountCodesListParams"; +export * from "./apiCommerceOrdersListParams"; +export * from "./apiCommerceProductImagesListParams"; +export * from "./apiCommerceProductsListParams"; +export * from "./apiCommerceRefundsListParams"; +export * from "./apiConfigurationAdminShopConfigurationListParams"; +export * from "./apiConfigurationPublicShopConfigurationListParams"; +export * from "./apiSchemaRetrieve200Four"; +export * from "./apiSchemaRetrieve200One"; +export * from "./apiSchemaRetrieve200Three"; +export * from "./apiSchemaRetrieve200Two"; +export * from "./apiSchemaRetrieveFormat"; +export * from "./apiSchemaRetrieveLang"; +export * from "./apiSchemaRetrieveParams"; +export * from "./apiZasilkovnaShipmentsListParams"; +export * from "./callback"; +export * from "./carrierRead"; +export * from "./category"; +export * from "./contact"; +export * from "./contactMe"; +export * from "./currencyEnum"; +export * from "./customTokenObtainPair"; +export * from "./customUser"; +export * from "./discountCode"; +export * from "./downloadErrorResponse"; +export * from "./downloadRequest"; +export * from "./downloaderStats"; +export * from "./errorResponse"; +export * from "./extEnum"; +export * from "./formatEnum"; +export * from "./gopayCreatePayment201"; +export * from "./gopayGetStatus200"; +export * from "./gopayRefundPayment200"; +export * from "./item"; +export * from "./orderCarrier"; +export * from "./orderCreate"; +export * from "./orderItemCreate"; +export * from "./orderItemRead"; +export * from "./orderMini"; +export * from "./orderRead"; +export * from "./paginatedCategoryList"; +export * from "./paginatedContactMeList"; +export * from "./paginatedCustomUserList"; +export * from "./paginatedDiscountCodeList"; +export * from "./paginatedOrderReadList"; +export * from "./paginatedProductImageList"; +export * from "./paginatedProductList"; +export * from "./paginatedRefundList"; +export * from "./paginatedSiteConfigurationAdminList"; +export * from "./paginatedSiteConfigurationPublicList"; +export * from "./paginatedZasilkovnaShipmentList"; +export * from "./passwordResetConfirm"; +export * from "./passwordResetRequest"; +export * from "./patchedCategory"; +export * from "./patchedContactMe"; +export * from "./patchedCustomUser"; +export * from "./patchedDiscountCode"; +export * from "./patchedOrderRead"; +export * from "./patchedProduct"; +export * from "./patchedProductImage"; +export * from "./patchedRefund"; +export * from "./patchedSiteConfigurationAdmin"; +export * from "./patchedSiteConfigurationAdminOpeningHours"; +export * from "./payer"; +export * from "./payment"; +export * from "./paymentBody"; +export * from "./paymentCreate"; +export * from "./paymentMethodEnum"; +export * from "./paymentRead"; +export * from "./product"; +export * from "./productImage"; +export * from "./productMini"; +export * from "./reasonChoiceEnum"; +export * from "./refund"; +export * from "./roleEnum"; +export * from "./shippingMethodEnum"; +export * from "./siteConfigurationAdmin"; +export * from "./siteConfigurationAdminOpeningHours"; +export * from "./siteConfigurationPublic"; +export * from "./siteConfigurationPublicOpeningHours"; +export * from "./stateE15Enum"; +export * from "./stateFdaEnum"; +export * from "./statusEnum"; +export * from "./trackingURL"; +export * from "./userRegistration"; +export * from "./videoInfoResponse"; +export * from "./zasilkovnaPacket"; +export * from "./zasilkovnaPacketRead"; +export * from "./zasilkovnaPacketReadReturnRouting"; +export * from "./zasilkovnaPacketReturnRouting"; +export * from "./zasilkovnaShipment"; diff --git a/frontend/src/api/generated/private/models/item.ts b/frontend/src/api/generated/private/models/item.ts new file mode 100644 index 0000000..c7a7c1e --- /dev/null +++ b/frontend/src/api/generated/private/models/item.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Item { + name: string; + /** + * Minor units + * @minimum 1 + */ + amount: number; + type?: string; + /** @minimum 1 */ + count?: number; +} diff --git a/frontend/src/api/generated/private/models/orderCarrier.ts b/frontend/src/api/generated/private/models/orderCarrier.ts new file mode 100644 index 0000000..2ae43b4 --- /dev/null +++ b/frontend/src/api/generated/private/models/orderCarrier.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ShippingMethodEnum } from "./shippingMethodEnum"; +import type { StateFdaEnum } from "./stateFdaEnum"; +import type { ZasilkovnaPacket } from "./zasilkovnaPacket"; + +export interface OrderCarrier { + shipping_method?: ShippingMethodEnum; + readonly state: StateFdaEnum; + readonly zasilkovna: readonly ZasilkovnaPacket[]; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly shipping_price: string; + packeta_address_id?: number; +} diff --git a/frontend/src/api/generated/private/models/orderCreate.ts b/frontend/src/api/generated/private/models/orderCreate.ts new file mode 100644 index 0000000..acd9220 --- /dev/null +++ b/frontend/src/api/generated/private/models/orderCreate.ts @@ -0,0 +1,24 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { OrderItemCreate } from "./orderItemCreate"; +import type { OrderCarrier } from "./orderCarrier"; +import type { Payment } from "./payment"; + +export interface OrderCreate { + first_name?: string; + last_name?: string; + email?: string; + phone?: string; + address?: string; + city?: string; + postal_code?: string; + country?: string; + note?: string; + items: OrderItemCreate[]; + carrier: OrderCarrier; + payment: Payment; + discount_codes?: string[]; +} diff --git a/frontend/src/api/generated/private/models/orderItemCreate.ts b/frontend/src/api/generated/private/models/orderItemCreate.ts new file mode 100644 index 0000000..5618bd6 --- /dev/null +++ b/frontend/src/api/generated/private/models/orderItemCreate.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface OrderItemCreate { + product_id: number; + /** @minimum 1 */ + quantity?: number; +} diff --git a/frontend/src/api/generated/private/models/orderItemRead.ts b/frontend/src/api/generated/private/models/orderItemRead.ts new file mode 100644 index 0000000..ac483dc --- /dev/null +++ b/frontend/src/api/generated/private/models/orderItemRead.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ProductMini } from "./productMini"; + +export interface OrderItemRead { + readonly id: number; + readonly product: ProductMini; + readonly quantity: number; +} diff --git a/frontend/src/api/generated/private/models/orderMini.ts b/frontend/src/api/generated/private/models/orderMini.ts new file mode 100644 index 0000000..b1f8b74 --- /dev/null +++ b/frontend/src/api/generated/private/models/orderMini.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StatusEnum } from "./statusEnum"; + +export interface OrderMini { + readonly id: number; + readonly status: StatusEnum; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly total_price: string; + readonly created_at: Date; +} diff --git a/frontend/src/api/generated/private/models/orderRead.ts b/frontend/src/api/generated/private/models/orderRead.ts new file mode 100644 index 0000000..4c6f2fa --- /dev/null +++ b/frontend/src/api/generated/private/models/orderRead.ts @@ -0,0 +1,34 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StatusEnum } from "./statusEnum"; +import type { OrderItemRead } from "./orderItemRead"; +import type { CarrierRead } from "./carrierRead"; +import type { PaymentRead } from "./paymentRead"; + +export interface OrderRead { + readonly id: number; + readonly status: StatusEnum; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly total_price: string; + readonly currency: string; + /** @nullable */ + readonly user: number | null; + readonly first_name: string; + readonly last_name: string; + readonly email: string; + readonly phone: string; + readonly address: string; + readonly city: string; + readonly postal_code: string; + readonly country: string; + readonly note: string; + readonly created_at: Date; + readonly updated_at: Date; + readonly items: readonly OrderItemRead[]; + readonly carrier: CarrierRead; + readonly payment: PaymentRead; + readonly discount_codes: string; +} diff --git a/frontend/src/api/generated/private/models/paginatedCategoryList.ts b/frontend/src/api/generated/private/models/paginatedCategoryList.ts new file mode 100644 index 0000000..2f1b588 --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedCategoryList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Category } from "./category"; + +export interface PaginatedCategoryList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: Category[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedContactMeList.ts b/frontend/src/api/generated/private/models/paginatedContactMeList.ts new file mode 100644 index 0000000..a21a2c2 --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedContactMeList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ContactMe } from "./contactMe"; + +export interface PaginatedContactMeList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: ContactMe[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedCustomUserList.ts b/frontend/src/api/generated/private/models/paginatedCustomUserList.ts new file mode 100644 index 0000000..a48846d --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedCustomUserList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { CustomUser } from "./customUser"; + +export interface PaginatedCustomUserList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: CustomUser[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedDiscountCodeList.ts b/frontend/src/api/generated/private/models/paginatedDiscountCodeList.ts new file mode 100644 index 0000000..99ae666 --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedDiscountCodeList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { DiscountCode } from "./discountCode"; + +export interface PaginatedDiscountCodeList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: DiscountCode[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedOrderReadList.ts b/frontend/src/api/generated/private/models/paginatedOrderReadList.ts new file mode 100644 index 0000000..0a71522 --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedOrderReadList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { OrderRead } from "./orderRead"; + +export interface PaginatedOrderReadList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: OrderRead[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedProductImageList.ts b/frontend/src/api/generated/private/models/paginatedProductImageList.ts new file mode 100644 index 0000000..9074e50 --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedProductImageList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ProductImage } from "./productImage"; + +export interface PaginatedProductImageList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: ProductImage[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedProductList.ts b/frontend/src/api/generated/private/models/paginatedProductList.ts new file mode 100644 index 0000000..86ec08a --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedProductList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Product } from "./product"; + +export interface PaginatedProductList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: Product[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedRefundList.ts b/frontend/src/api/generated/private/models/paginatedRefundList.ts new file mode 100644 index 0000000..b76cf5e --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedRefundList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Refund } from "./refund"; + +export interface PaginatedRefundList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: Refund[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedSiteConfigurationAdminList.ts b/frontend/src/api/generated/private/models/paginatedSiteConfigurationAdminList.ts new file mode 100644 index 0000000..22334d9 --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedSiteConfigurationAdminList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationAdmin } from "./siteConfigurationAdmin"; + +export interface PaginatedSiteConfigurationAdminList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: SiteConfigurationAdmin[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedSiteConfigurationPublicList.ts b/frontend/src/api/generated/private/models/paginatedSiteConfigurationPublicList.ts new file mode 100644 index 0000000..1f221bb --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedSiteConfigurationPublicList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationPublic } from "./siteConfigurationPublic"; + +export interface PaginatedSiteConfigurationPublicList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: SiteConfigurationPublic[]; +} diff --git a/frontend/src/api/generated/private/models/paginatedZasilkovnaShipmentList.ts b/frontend/src/api/generated/private/models/paginatedZasilkovnaShipmentList.ts new file mode 100644 index 0000000..d7dc36a --- /dev/null +++ b/frontend/src/api/generated/private/models/paginatedZasilkovnaShipmentList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ZasilkovnaShipment } from "./zasilkovnaShipment"; + +export interface PaginatedZasilkovnaShipmentList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: ZasilkovnaShipment[]; +} diff --git a/frontend/src/api/generated/private/models/passwordResetConfirm.ts b/frontend/src/api/generated/private/models/passwordResetConfirm.ts new file mode 100644 index 0000000..05b6555 --- /dev/null +++ b/frontend/src/api/generated/private/models/passwordResetConfirm.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PasswordResetConfirm { + /** Nové heslo musí mít alespoň 8 znaků, obsahovat velká a malá písmena a číslici. */ + password: string; +} diff --git a/frontend/src/api/generated/private/models/passwordResetRequest.ts b/frontend/src/api/generated/private/models/passwordResetRequest.ts new file mode 100644 index 0000000..5a0bd8d --- /dev/null +++ b/frontend/src/api/generated/private/models/passwordResetRequest.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PasswordResetRequest { + /** E-mail registrovaného a aktivního uživatele, na který bude zaslán reset hesla. */ + email: string; +} diff --git a/frontend/src/api/generated/private/models/patchedCategory.ts b/frontend/src/api/generated/private/models/patchedCategory.ts new file mode 100644 index 0000000..419d2dd --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedCategory.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedCategory { + readonly id?: number; + /** @maxLength 100 */ + name?: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url?: string; + /** @nullable */ + parent?: number | null; + description?: string; + image?: string; +} diff --git a/frontend/src/api/generated/private/models/patchedContactMe.ts b/frontend/src/api/generated/private/models/patchedContactMe.ts new file mode 100644 index 0000000..c3201fd --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedContactMe.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedContactMe { + readonly id?: number; + /** @maxLength 254 */ + client_email?: string; + content?: string; + readonly sent_at?: Date; +} diff --git a/frontend/src/api/generated/private/models/patchedCustomUser.ts b/frontend/src/api/generated/private/models/patchedCustomUser.ts new file mode 100644 index 0000000..3078778 --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedCustomUser.ts @@ -0,0 +1,45 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { RoleEnum } from "./roleEnum"; + +export interface PatchedCustomUser { + readonly id?: number; + /** Požadováno. 150 znaků nebo méně. Pouze písmena, číslice a znaky @/./+/-/_. */ + readonly username?: string; + /** @maxLength 150 */ + first_name?: string; + /** @maxLength 150 */ + last_name?: string; + /** @maxLength 254 */ + email?: string; + role?: RoleEnum; + email_verified?: boolean; + /** + * @maxLength 16 + * @nullable + * @pattern ^\+?\d{9,15}$ + */ + phone_number?: string | null; + readonly create_time?: Date; + /** + * @maxLength 100 + * @nullable + */ + city?: string | null; + /** + * @maxLength 200 + * @nullable + */ + street?: string | null; + /** + * @maxLength 5 + * @nullable + * @pattern ^\d{5}$ + */ + postal_code?: string | null; + readonly gdpr?: boolean; + is_active?: boolean; +} diff --git a/frontend/src/api/generated/private/models/patchedDiscountCode.ts b/frontend/src/api/generated/private/models/patchedDiscountCode.ts new file mode 100644 index 0000000..81092bb --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedDiscountCode.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedDiscountCode { + readonly id?: number; + /** @maxLength 50 */ + code?: string; + /** @maxLength 255 */ + description?: string; + /** + * Procento sleva 0-100 + * @minimum 0 + * @maximum 100 + * @nullable + */ + percent?: number | null; + /** + * Fixní sleva v CZK + * @nullable + * @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ + */ + amount?: string | null; + valid_from?: Date; + /** @nullable */ + valid_to?: Date | null; + active?: boolean; + /** + * @minimum 0 + * @maximum 9223372036854776000 + * @nullable + */ + usage_limit?: number | null; + readonly used_count?: number; + specific_products?: number[]; + specific_categories?: number[]; +} diff --git a/frontend/src/api/generated/private/models/patchedOrderRead.ts b/frontend/src/api/generated/private/models/patchedOrderRead.ts new file mode 100644 index 0000000..5b722aa --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedOrderRead.ts @@ -0,0 +1,34 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StatusEnum } from "./statusEnum"; +import type { OrderItemRead } from "./orderItemRead"; +import type { CarrierRead } from "./carrierRead"; +import type { PaymentRead } from "./paymentRead"; + +export interface PatchedOrderRead { + readonly id?: number; + readonly status?: StatusEnum; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly total_price?: string; + readonly currency?: string; + /** @nullable */ + readonly user?: number | null; + readonly first_name?: string; + readonly last_name?: string; + readonly email?: string; + readonly phone?: string; + readonly address?: string; + readonly city?: string; + readonly postal_code?: string; + readonly country?: string; + readonly note?: string; + readonly created_at?: Date; + readonly updated_at?: Date; + readonly items?: readonly OrderItemRead[]; + readonly carrier?: CarrierRead; + readonly payment?: PaymentRead; + readonly discount_codes?: string; +} diff --git a/frontend/src/api/generated/private/models/patchedProduct.ts b/frontend/src/api/generated/private/models/patchedProduct.ts new file mode 100644 index 0000000..0365abd --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedProduct.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedProduct { + readonly id?: number; + /** @maxLength 200 */ + name?: string; + description?: string; + /** + * @maxLength 100 + * @nullable + */ + code?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + price?: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url?: string; + /** + * @minimum 0 + * @maximum 9223372036854776000 + */ + stock?: number; + is_active?: boolean; + /** @nullable */ + limited_to?: Date | null; + readonly created_at?: Date; + readonly updated_at?: Date; + category?: number; + /** @nullable */ + default_carrier?: number | null; + /** Symetrické varianty produktu: pokud přidáte variantu A → B, Django automaticky přidá i variantu B → A. Všechny varianty jsou rovnocenné a zobrazí se vzájemně. */ + variants?: number[]; +} diff --git a/frontend/src/api/generated/private/models/patchedProductImage.ts b/frontend/src/api/generated/private/models/patchedProductImage.ts new file mode 100644 index 0000000..276f2e0 --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedProductImage.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedProductImage { + readonly id?: number; + product?: number; + image?: string; + /** @maxLength 150 */ + alt_text?: string; + is_main?: boolean; +} diff --git a/frontend/src/api/generated/private/models/patchedRefund.ts b/frontend/src/api/generated/private/models/patchedRefund.ts new file mode 100644 index 0000000..bf8cfbc --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedRefund.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ReasonChoiceEnum } from "./reasonChoiceEnum"; + +export interface PatchedRefund { + readonly id?: number; + reason_choice?: ReasonChoiceEnum; + reason_text?: string; + readonly verified?: boolean; + readonly created_at?: Date; + order?: number; +} diff --git a/frontend/src/api/generated/private/models/patchedSiteConfigurationAdmin.ts b/frontend/src/api/generated/private/models/patchedSiteConfigurationAdmin.ts new file mode 100644 index 0000000..7967712 --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedSiteConfigurationAdmin.ts @@ -0,0 +1,77 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PatchedSiteConfigurationAdminOpeningHours } from "./patchedSiteConfigurationAdminOpeningHours"; +import type { CurrencyEnum } from "./currencyEnum"; + +export interface PatchedSiteConfigurationAdmin { + readonly id?: number; + /** @maxLength 100 */ + name?: string; + /** @nullable */ + logo?: string | null; + /** @nullable */ + favicon?: string | null; + /** + * @maxLength 254 + * @nullable + */ + contact_email?: string | null; + /** + * @maxLength 20 + * @nullable + */ + contact_phone?: string | null; + /** @nullable */ + contact_address?: string | null; + /** @nullable */ + opening_hours?: PatchedSiteConfigurationAdminOpeningHours; + /** + * @maxLength 200 + * @nullable + */ + facebook_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + instagram_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + youtube_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + tiktok_url?: string | null; + /** + * @maxLength 20 + * @nullable + */ + whatsapp_number?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + zasilkovna_shipping_price?: string; + /** + * API klíč pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_key?: string | null; + /** + * API heslo pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_password?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + free_shipping_over?: string; + /** Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + multiplying_coupons?: boolean; + /** Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + addition_of_coupons_amount?: boolean; + currency?: CurrencyEnum; +} diff --git a/frontend/src/api/generated/private/models/patchedSiteConfigurationAdminOpeningHours.ts b/frontend/src/api/generated/private/models/patchedSiteConfigurationAdminOpeningHours.ts new file mode 100644 index 0000000..0e4a062 --- /dev/null +++ b/frontend/src/api/generated/private/models/patchedSiteConfigurationAdminOpeningHours.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * @nullable + */ +export type PatchedSiteConfigurationAdminOpeningHours = unknown | null; diff --git a/frontend/src/api/generated/private/models/payer.ts b/frontend/src/api/generated/private/models/payer.ts new file mode 100644 index 0000000..e90d28f --- /dev/null +++ b/frontend/src/api/generated/private/models/payer.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Contact } from "./contact"; + +export interface Payer { + contact: Contact; + allowed_payment_instruments?: string[]; + default_payment_instrument?: string; + allowed_swifts?: string[]; + default_swift?: string; +} diff --git a/frontend/src/api/generated/private/models/payment.ts b/frontend/src/api/generated/private/models/payment.ts new file mode 100644 index 0000000..6b383e7 --- /dev/null +++ b/frontend/src/api/generated/private/models/payment.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PaymentMethodEnum } from "./paymentMethodEnum"; + +export interface Payment { + readonly id: number; + payment_method?: PaymentMethodEnum; + /** @nullable */ + readonly stripe: number | null; + readonly stripe_session_id: string; + readonly stripe_payment_intent: string; + readonly stripe_session_url: string; +} diff --git a/frontend/src/api/generated/private/models/paymentBody.ts b/frontend/src/api/generated/private/models/paymentBody.ts new file mode 100644 index 0000000..69e05bd --- /dev/null +++ b/frontend/src/api/generated/private/models/paymentBody.ts @@ -0,0 +1,26 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Payer } from "./payer"; +import type { Callback } from "./callback"; +import type { Item } from "./item"; +import type { AdditionalParam } from "./additionalParam"; + +export interface PaymentBody { + /** + * Minor units (e.g. 100 CZK = 10000) + * @minimum 1 + */ + amount: number; + currency: string; + order_number: string; + order_description?: string; + payer: Payer; + callback: Callback; + items?: Item[]; + additional_params?: AdditionalParam[]; + lang?: string; + preauthorize?: boolean; +} diff --git a/frontend/src/api/generated/private/models/paymentCreate.ts b/frontend/src/api/generated/private/models/paymentCreate.ts new file mode 100644 index 0000000..2bc6115 --- /dev/null +++ b/frontend/src/api/generated/private/models/paymentCreate.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PaymentBody } from "./paymentBody"; + +export interface PaymentCreate { + payment: PaymentBody; + user_id?: number; +} diff --git a/frontend/src/api/generated/private/models/paymentMethodEnum.ts b/frontend/src/api/generated/private/models/paymentMethodEnum.ts new file mode 100644 index 0000000..dae3eda --- /dev/null +++ b/frontend/src/api/generated/private/models/paymentMethodEnum.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `Site` - cz#Platba v obchodě + * `stripe` - cz#Bankovní převod + * `cash_on_delivery` - cz#Dobírka + */ +export type PaymentMethodEnum = + (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const PaymentMethodEnum = { + Site: "Site", + stripe: "stripe", + cash_on_delivery: "cash_on_delivery", +} as const; diff --git a/frontend/src/api/generated/private/models/paymentRead.ts b/frontend/src/api/generated/private/models/paymentRead.ts new file mode 100644 index 0000000..174cbb3 --- /dev/null +++ b/frontend/src/api/generated/private/models/paymentRead.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PaymentMethodEnum } from "./paymentMethodEnum"; + +export interface PaymentRead { + readonly payment_method: PaymentMethodEnum; +} diff --git a/frontend/src/api/generated/private/models/product.ts b/frontend/src/api/generated/private/models/product.ts new file mode 100644 index 0000000..6146b27 --- /dev/null +++ b/frontend/src/api/generated/private/models/product.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Product { + readonly id: number; + /** @maxLength 200 */ + name: string; + description?: string; + /** + * @maxLength 100 + * @nullable + */ + code?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + price: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url: string; + /** + * @minimum 0 + * @maximum 9223372036854776000 + */ + stock?: number; + is_active?: boolean; + /** @nullable */ + limited_to?: Date | null; + readonly created_at: Date; + readonly updated_at: Date; + category: number; + /** @nullable */ + default_carrier?: number | null; + /** Symetrické varianty produktu: pokud přidáte variantu A → B, Django automaticky přidá i variantu B → A. Všechny varianty jsou rovnocenné a zobrazí se vzájemně. */ + variants?: number[]; +} diff --git a/frontend/src/api/generated/private/models/productImage.ts b/frontend/src/api/generated/private/models/productImage.ts new file mode 100644 index 0000000..a192a08 --- /dev/null +++ b/frontend/src/api/generated/private/models/productImage.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ProductImage { + readonly id: number; + product: number; + image: string; + /** @maxLength 150 */ + alt_text?: string; + is_main?: boolean; +} diff --git a/frontend/src/api/generated/private/models/productMini.ts b/frontend/src/api/generated/private/models/productMini.ts new file mode 100644 index 0000000..ce227a0 --- /dev/null +++ b/frontend/src/api/generated/private/models/productMini.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ProductMini { + readonly id: number; + /** @maxLength 200 */ + name: string; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + price: string; +} diff --git a/frontend/src/api/generated/private/models/reasonChoiceEnum.ts b/frontend/src/api/generated/private/models/reasonChoiceEnum.ts new file mode 100644 index 0000000..f7311f2 --- /dev/null +++ b/frontend/src/api/generated/private/models/reasonChoiceEnum.ts @@ -0,0 +1,22 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `retuning_before_fourteen_day_period` - cz#Vrácení před uplynutím 14-ti denní lhůty + * `damaged_product` - cz#Poškozený produkt + * `wrong_item` - cz#Špatná položka + * `other` - cz#Jiný důvod + */ +export type ReasonChoiceEnum = + (typeof ReasonChoiceEnum)[keyof typeof ReasonChoiceEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ReasonChoiceEnum = { + retuning_before_fourteen_day_period: "retuning_before_fourteen_day_period", + damaged_product: "damaged_product", + wrong_item: "wrong_item", + other: "other", +} as const; diff --git a/frontend/src/api/generated/private/models/refund.ts b/frontend/src/api/generated/private/models/refund.ts new file mode 100644 index 0000000..0b154d8 --- /dev/null +++ b/frontend/src/api/generated/private/models/refund.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ReasonChoiceEnum } from "./reasonChoiceEnum"; + +export interface Refund { + readonly id: number; + reason_choice: ReasonChoiceEnum; + reason_text?: string; + readonly verified: boolean; + readonly created_at: Date; + order: number; +} diff --git a/frontend/src/api/generated/private/models/roleEnum.ts b/frontend/src/api/generated/private/models/roleEnum.ts new file mode 100644 index 0000000..18f15f4 --- /dev/null +++ b/frontend/src/api/generated/private/models/roleEnum.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `admin` - cz#Administrátor + * `mod` - cz#Moderator + * `regular` - cz#Regular + */ +export type RoleEnum = (typeof RoleEnum)[keyof typeof RoleEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const RoleEnum = { + admin: "admin", + mod: "mod", + regular: "regular", +} as const; diff --git a/frontend/src/api/generated/private/models/shippingMethodEnum.ts b/frontend/src/api/generated/private/models/shippingMethodEnum.ts new file mode 100644 index 0000000..50ed123 --- /dev/null +++ b/frontend/src/api/generated/private/models/shippingMethodEnum.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `packeta` - cz#Zásilkovna + * `store` - cz#Osobní odběr + */ +export type ShippingMethodEnum = + (typeof ShippingMethodEnum)[keyof typeof ShippingMethodEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ShippingMethodEnum = { + packeta: "packeta", + store: "store", +} as const; diff --git a/frontend/src/api/generated/private/models/siteConfigurationAdmin.ts b/frontend/src/api/generated/private/models/siteConfigurationAdmin.ts new file mode 100644 index 0000000..0a029ea --- /dev/null +++ b/frontend/src/api/generated/private/models/siteConfigurationAdmin.ts @@ -0,0 +1,77 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationAdminOpeningHours } from "./siteConfigurationAdminOpeningHours"; +import type { CurrencyEnum } from "./currencyEnum"; + +export interface SiteConfigurationAdmin { + readonly id: number; + /** @maxLength 100 */ + name?: string; + /** @nullable */ + logo?: string | null; + /** @nullable */ + favicon?: string | null; + /** + * @maxLength 254 + * @nullable + */ + contact_email?: string | null; + /** + * @maxLength 20 + * @nullable + */ + contact_phone?: string | null; + /** @nullable */ + contact_address?: string | null; + /** @nullable */ + opening_hours?: SiteConfigurationAdminOpeningHours; + /** + * @maxLength 200 + * @nullable + */ + facebook_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + instagram_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + youtube_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + tiktok_url?: string | null; + /** + * @maxLength 20 + * @nullable + */ + whatsapp_number?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + zasilkovna_shipping_price?: string; + /** + * API klíč pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_key?: string | null; + /** + * API heslo pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_password?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + free_shipping_over?: string; + /** Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + multiplying_coupons?: boolean; + /** Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + addition_of_coupons_amount?: boolean; + currency?: CurrencyEnum; +} diff --git a/frontend/src/api/generated/private/models/siteConfigurationAdminOpeningHours.ts b/frontend/src/api/generated/private/models/siteConfigurationAdminOpeningHours.ts new file mode 100644 index 0000000..e79fcad --- /dev/null +++ b/frontend/src/api/generated/private/models/siteConfigurationAdminOpeningHours.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * @nullable + */ +export type SiteConfigurationAdminOpeningHours = unknown | null; diff --git a/frontend/src/api/generated/private/models/siteConfigurationPublic.ts b/frontend/src/api/generated/private/models/siteConfigurationPublic.ts new file mode 100644 index 0000000..0887202 --- /dev/null +++ b/frontend/src/api/generated/private/models/siteConfigurationPublic.ts @@ -0,0 +1,56 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationPublicOpeningHours } from "./siteConfigurationPublicOpeningHours"; +import type { CurrencyEnum } from "./currencyEnum"; + +export interface SiteConfigurationPublic { + readonly id: number; + /** @maxLength 100 */ + name?: string; + /** @nullable */ + logo?: string | null; + /** @nullable */ + favicon?: string | null; + /** + * @maxLength 254 + * @nullable + */ + contact_email?: string | null; + /** + * @maxLength 20 + * @nullable + */ + contact_phone?: string | null; + /** @nullable */ + contact_address?: string | null; + /** @nullable */ + opening_hours?: SiteConfigurationPublicOpeningHours; + /** + * @maxLength 200 + * @nullable + */ + facebook_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + instagram_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + youtube_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + tiktok_url?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + zasilkovna_shipping_price?: string; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + free_shipping_over?: string; + currency?: CurrencyEnum; +} diff --git a/frontend/src/api/generated/private/models/siteConfigurationPublicOpeningHours.ts b/frontend/src/api/generated/private/models/siteConfigurationPublicOpeningHours.ts new file mode 100644 index 0000000..300d3d4 --- /dev/null +++ b/frontend/src/api/generated/private/models/siteConfigurationPublicOpeningHours.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * @nullable + */ +export type SiteConfigurationPublicOpeningHours = unknown | null; diff --git a/frontend/src/api/generated/private/models/stateE15Enum.ts b/frontend/src/api/generated/private/models/stateE15Enum.ts new file mode 100644 index 0000000..e2ca3c9 --- /dev/null +++ b/frontend/src/api/generated/private/models/stateE15Enum.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `WAITING_FOR_ORDERING_SHIPMENT` - cz#Čeká na objednání zásilkovny + * `PENDING` - cz#Podáno + * `SENDED` - cz#Odesláno + * `ARRIVED` - cz#Doručeno + * `CANCELED` - cz#Zrušeno + * `RETURNING` - cz#Posláno zpátky + * `RETURNED` - cz#Vráceno + */ +export type StateE15Enum = (typeof StateE15Enum)[keyof typeof StateE15Enum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const StateE15Enum = { + WAITING_FOR_ORDERING_SHIPMENT: "WAITING_FOR_ORDERING_SHIPMENT", + PENDING: "PENDING", + SENDED: "SENDED", + ARRIVED: "ARRIVED", + CANCELED: "CANCELED", + RETURNING: "RETURNING", + RETURNED: "RETURNED", +} as const; diff --git a/frontend/src/api/generated/private/models/stateFdaEnum.ts b/frontend/src/api/generated/private/models/stateFdaEnum.ts new file mode 100644 index 0000000..d76f293 --- /dev/null +++ b/frontend/src/api/generated/private/models/stateFdaEnum.ts @@ -0,0 +1,21 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `ordered` - cz#Objednávka se připravuje + * `shipped` - cz#Odesláno + * `delivered` - cz#Doručeno + * `ready_to_pickup` - cz#Připraveno k vyzvednutí + */ +export type StateFdaEnum = (typeof StateFdaEnum)[keyof typeof StateFdaEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const StateFdaEnum = { + ordered: "ordered", + shipped: "shipped", + delivered: "delivered", + ready_to_pickup: "ready_to_pickup", +} as const; diff --git a/frontend/src/api/generated/private/models/statusEnum.ts b/frontend/src/api/generated/private/models/statusEnum.ts new file mode 100644 index 0000000..9194303 --- /dev/null +++ b/frontend/src/api/generated/private/models/statusEnum.ts @@ -0,0 +1,23 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `created` - cz#Vytvořeno + * `cancelled` - cz#Zrušeno + * `completed` - cz#Dokončeno + * `refunding` - cz#Vrácení v procesu + * `refunded` - cz#Vráceno + */ +export type StatusEnum = (typeof StatusEnum)[keyof typeof StatusEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const StatusEnum = { + created: "created", + cancelled: "cancelled", + completed: "completed", + refunding: "refunding", + refunded: "refunded", +} as const; diff --git a/frontend/src/api/generated/private/models/trackingURL.ts b/frontend/src/api/generated/private/models/trackingURL.ts new file mode 100644 index 0000000..056d051 --- /dev/null +++ b/frontend/src/api/generated/private/models/trackingURL.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface TrackingURL { + readonly barcode: string; + readonly tracking_url: string; +} diff --git a/frontend/src/api/generated/private/models/userRegistration.ts b/frontend/src/api/generated/private/models/userRegistration.ts new file mode 100644 index 0000000..52db518 --- /dev/null +++ b/frontend/src/api/generated/private/models/userRegistration.ts @@ -0,0 +1,53 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface UserRegistration { + /** + * Křestní jméno uživatele + * @maxLength 150 + */ + first_name: string; + /** + * Příjmení uživatele + * @maxLength 150 + */ + last_name: string; + /** + * Emailová adresa uživatele + * @maxLength 254 + */ + email: string; + /** + * Telefonní číslo uživatele + * @maxLength 16 + * @nullable + * @pattern ^\+?\d{9,15}$ + */ + phone_number: string | null; + /** Heslo musí mít alespoň 8 znaků, obsahovat velká a malá písmena a číslici. */ + password: string; + /** + * Město uživatele + * @maxLength 100 + * @nullable + */ + city: string | null; + /** + * Ulice uživatele + * @maxLength 200 + * @nullable + */ + street: string | null; + /** + * PSČ uživatele + * @maxLength 5 + * @nullable + * @pattern ^\d{5}$ + */ + postal_code: string | null; + /** Souhlas se zpracováním osobních údajů */ + gdpr: boolean; +} diff --git a/frontend/src/api/generated/private/models/videoInfoResponse.ts b/frontend/src/api/generated/private/models/videoInfoResponse.ts new file mode 100644 index 0000000..9858144 --- /dev/null +++ b/frontend/src/api/generated/private/models/videoInfoResponse.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface VideoInfoResponse { + title: string; + /** @nullable */ + duration: number | null; + /** @nullable */ + thumbnail: string | null; + video_resolutions: string[]; + audio_resolutions: string[]; +} diff --git a/frontend/src/api/generated/private/models/zasilkovnaPacket.ts b/frontend/src/api/generated/private/models/zasilkovnaPacket.ts new file mode 100644 index 0000000..3164441 --- /dev/null +++ b/frontend/src/api/generated/private/models/zasilkovnaPacket.ts @@ -0,0 +1,32 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StateE15Enum } from "./stateE15Enum"; +import type { ZasilkovnaPacketReturnRouting } from "./zasilkovnaPacketReturnRouting"; + +export interface ZasilkovnaPacket { + readonly id: number; + readonly created_at: Date; + /** + * Číslo zásilky v Packetě (vraceno od API od Packety) + * @minimum -9223372036854776000 + * @maximum 9223372036854776000 + * @nullable + */ + packet_id?: number | null; + /** + * Čárový kód zásilky od Packety + * @nullable + */ + readonly barcode: string | null; + readonly state: StateE15Enum; + /** Hmotnost zásilky v gramech */ + readonly weight: number; + /** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ + readonly return_routing: ZasilkovnaPacketReturnRouting; +} diff --git a/frontend/src/api/generated/private/models/zasilkovnaPacketRead.ts b/frontend/src/api/generated/private/models/zasilkovnaPacketRead.ts new file mode 100644 index 0000000..a99eb56 --- /dev/null +++ b/frontend/src/api/generated/private/models/zasilkovnaPacketRead.ts @@ -0,0 +1,32 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StateE15Enum } from "./stateE15Enum"; +import type { ZasilkovnaPacketReadReturnRouting } from "./zasilkovnaPacketReadReturnRouting"; + +export interface ZasilkovnaPacketRead { + readonly id: number; + readonly created_at: Date; + /** + * Číslo zásilky v Packetě (vraceno od API od Packety) + * @minimum -9223372036854776000 + * @maximum 9223372036854776000 + * @nullable + */ + packet_id?: number | null; + /** + * Čárový kód zásilky od Packety + * @nullable + */ + readonly barcode: string | null; + readonly state: StateE15Enum; + /** Hmotnost zásilky v gramech */ + readonly weight: number; + /** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ + readonly return_routing: ZasilkovnaPacketReadReturnRouting; +} diff --git a/frontend/src/api/generated/private/models/zasilkovnaPacketReadReturnRouting.ts b/frontend/src/api/generated/private/models/zasilkovnaPacketReadReturnRouting.ts new file mode 100644 index 0000000..cfcb819 --- /dev/null +++ b/frontend/src/api/generated/private/models/zasilkovnaPacketReadReturnRouting.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ +export type ZasilkovnaPacketReadReturnRouting = unknown | null; diff --git a/frontend/src/api/generated/private/models/zasilkovnaPacketReturnRouting.ts b/frontend/src/api/generated/private/models/zasilkovnaPacketReturnRouting.ts new file mode 100644 index 0000000..0cf56d3 --- /dev/null +++ b/frontend/src/api/generated/private/models/zasilkovnaPacketReturnRouting.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ +export type ZasilkovnaPacketReturnRouting = unknown | null; diff --git a/frontend/src/api/generated/private/models/zasilkovnaShipment.ts b/frontend/src/api/generated/private/models/zasilkovnaShipment.ts new file mode 100644 index 0000000..7929af0 --- /dev/null +++ b/frontend/src/api/generated/private/models/zasilkovnaShipment.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ZasilkovnaShipment { + readonly id: number; + readonly created_at: Date; + /** ID zásilky v Packetě */ + readonly shipment_id: string; + /** Čárový kód zásilky v Packetě (format: ) */ + readonly barcode: string; + packets: number[]; +} diff --git a/frontend/src/api/generated/private/order/order.ts b/frontend/src/api/generated/private/order/order.ts new file mode 100644 index 0000000..93609c8 --- /dev/null +++ b/frontend/src/api/generated/private/order/order.ts @@ -0,0 +1,102 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useMutation } from "@tanstack/react-query"; +import type { + MutationFunction, + QueryClient, + UseMutationOptions, + UseMutationResult, +} from "@tanstack/react-query"; + +import type { OrderCreate, OrderRead } from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +/** + * @summary Create Order (public) + */ +export const apiCommerceOrdersCreate = ( + orderCreate: OrderCreate, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/orders/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: orderCreate, + signal, + }); +}; + +export const getApiCommerceOrdersCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: OrderCreate }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: OrderCreate }, + TContext +> => { + const mutationKey = ["apiCommerceOrdersCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: OrderCreate } + > = (props) => { + const { data } = props ?? {}; + + return apiCommerceOrdersCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceOrdersCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersCreateMutationBody = OrderCreate; +export type ApiCommerceOrdersCreateMutationError = unknown; + +/** + * @summary Create Order (public) + */ +export const useApiCommerceOrdersCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: OrderCreate }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: OrderCreate }, + TContext +> => { + const mutationOptions = getApiCommerceOrdersCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/orders/orders.ts b/frontend/src/api/generated/private/orders/orders.ts new file mode 100644 index 0000000..2212404 --- /dev/null +++ b/frontend/src/api/generated/private/orders/orders.ts @@ -0,0 +1,694 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiCommerceOrdersListParams, + OrderRead, + PaginatedOrderReadList, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +/** + * @summary List Orders (public) + */ +export const apiCommerceOrdersList = ( + params?: ApiCommerceOrdersListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/orders/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiCommerceOrdersListInfiniteQueryKey = ( + params?: ApiCommerceOrdersListParams, +) => { + return [ + "infinite", + `/api/commerce/orders/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceOrdersListQueryKey = ( + params?: ApiCommerceOrdersListParams, +) => { + return [`/api/commerce/orders/`, ...(params ? [params] : [])] as const; +}; + +export const getApiCommerceOrdersListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiCommerceOrdersListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceOrdersListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiCommerceOrdersListParams["page"] + > = ({ signal, pageParam }) => + apiCommerceOrdersList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceOrdersListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersListInfiniteQueryError = unknown; + +export function useApiCommerceOrdersListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceOrdersListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiCommerceOrdersListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceOrdersListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceOrdersListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceOrdersListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceOrdersListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceOrdersListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Orders (public) + */ + +export function useApiCommerceOrdersListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceOrdersListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceOrdersListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceOrdersListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersListQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersListQueryError = unknown; + +export function useApiCommerceOrdersList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiCommerceOrdersListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List Orders (public) + */ + +export function useApiCommerceOrdersList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceOrdersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersListQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Retrieve Order (public) + */ +export const apiCommerceOrdersRetrieve = (id: number, signal?: AbortSignal) => { + return privateMutator({ + url: `/api/commerce/orders/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceOrdersRetrieveInfiniteQueryKey = (id?: number) => { + return ["infinite", `/api/commerce/orders/${id}/`] as const; +}; + +export const getApiCommerceOrdersRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/orders/${id}/`] as const; +}; + +export const getApiCommerceOrdersRetrieveInfiniteQueryOptions = < + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceOrdersRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve Order (public) + */ + +export function useApiCommerceOrdersRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceOrdersRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceOrdersRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceOrdersRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceOrdersRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceOrdersRetrieveQueryError = unknown; + +export function useApiCommerceOrdersRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceOrdersRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve Order (public) + */ + +export function useApiCommerceOrdersRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceOrdersRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/private/packet/packet.ts b/frontend/src/api/generated/private/packet/packet.ts new file mode 100644 index 0000000..67b526a --- /dev/null +++ b/frontend/src/api/generated/private/packet/packet.ts @@ -0,0 +1,1252 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { TrackingURL, ZasilkovnaPacket } from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +/** + * #TODO: Popis endpointu + * @summary Packet + */ +export const apiZasilkovnaPacketsRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/zasilkovna/packets/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiZasilkovnaPacketsRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/zasilkovna/packets/${id}/`] as const; +}; + +export const getApiZasilkovnaPacketsRetrieveQueryKey = (id?: number) => { + return [`/api/zasilkovna/packets/${id}/`] as const; +}; + +export const getApiZasilkovnaPacketsRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaPacketsRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaPacketsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaPacketsRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaPacketsRetrieveInfiniteQueryError = unknown; + +export function useApiZasilkovnaPacketsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Packet + */ + +export function useApiZasilkovnaPacketsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaPacketsRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiZasilkovnaPacketsRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiZasilkovnaPacketsRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaPacketsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaPacketsRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaPacketsRetrieveQueryError = unknown; + +export function useApiZasilkovnaPacketsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Packet + */ + +export function useApiZasilkovnaPacketsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaPacketsRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Cancels the packet through the Packeta API and updates its state to CANCELED. No request body is required. + * @summary Cancel packet + */ +export const apiZasilkovnaPacketsCancelPartialUpdate = (id: number) => { + return privateMutator({ + url: `/api/zasilkovna/packets/${id}/cancel/`, + method: "PATCH", + }); +}; + +export const getApiZasilkovnaPacketsCancelPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiZasilkovnaPacketsCancelPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiZasilkovnaPacketsCancelPartialUpdate(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiZasilkovnaPacketsCancelPartialUpdateMutationResult = NonNullable< + Awaited> +>; + +export type ApiZasilkovnaPacketsCancelPartialUpdateMutationError = unknown; + +/** + * @summary Cancel packet + */ +export const useApiZasilkovnaPacketsCancelPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiZasilkovnaPacketsCancelPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Objedná přepravu přes API Packety,podle existujicího objektu, kde je od uživatele uložený id od místa poslání. + * @summary Order shipping + */ +export const apiZasilkovnaPacketsOrderShippingPartialUpdate = (id: number) => { + return privateMutator({ + url: `/api/zasilkovna/packets/${id}/order-shipping/`, + method: "PATCH", + }); +}; + +export const getApiZasilkovnaPacketsOrderShippingPartialUpdateMutationOptions = + (options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number }, + TContext + >; + }): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + > => { + const mutationKey = ["apiZasilkovnaPacketsOrderShippingPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited< + ReturnType + >, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiZasilkovnaPacketsOrderShippingPartialUpdate(id); + }; + + return { mutationFn, ...mutationOptions }; + }; + +export type ApiZasilkovnaPacketsOrderShippingPartialUpdateMutationResult = + NonNullable< + Awaited> + >; + +export type ApiZasilkovnaPacketsOrderShippingPartialUpdateMutationError = + unknown; + +/** + * @summary Order shipping + */ +export const useApiZasilkovnaPacketsOrderShippingPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited< + ReturnType + >, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiZasilkovnaPacketsOrderShippingPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Returns HTML widget for user to select pickup point. No request body is required. + * @summary Get widget for user, to select pickup point. + */ +export const apiZasilkovnaPacketsPickupPointWidgetRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/zasilkovna/packets/${id}/pickup-point-widget/`, + method: "GET", + signal, + }); +}; + +export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryKey = + (id?: number) => { + return [ + "infinite", + `/api/zasilkovna/packets/${id}/pickup-point-widget/`, + ] as const; + }; + +export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryKey = ( + id?: number, +) => { + return [`/api/zasilkovna/packets/${id}/pickup-point-widget/`] as const; +}; + +export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryOptions = + < + TData = InfiniteData< + Awaited> + >, + TError = unknown, + >( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + ) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => + apiZasilkovnaPacketsPickupPointWidgetRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; + }; + +export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryError = + unknown; + +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get widget for user, to select pickup point. + */ + +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryOptions = < + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaPacketsPickupPointWidgetRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryResult = + NonNullable< + Awaited> + >; +export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryError = unknown; + +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited< + ReturnType + >, + TError, + Awaited< + ReturnType + > + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get widget for user, to select pickup point. + */ + +export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve< + TData = Awaited< + ReturnType + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited< + ReturnType + >, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Returns the public Zásilkovna tracking URL derived from the packet's barcode. + * @summary Get public tracking URL + */ +export const apiZasilkovnaPacketsTrackingUrlRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/zasilkovna/packets/${id}/tracking-url/`, + method: "GET", + signal, + }); +}; + +export const getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/zasilkovna/packets/${id}/tracking-url/`] as const; +}; + +export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryKey = ( + id?: number, +) => { + return [`/api/zasilkovna/packets/${id}/tracking-url/`] as const; +}; + +export const getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaPacketsTrackingUrlRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryResult = + NonNullable< + Awaited> + >; +export type ApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryError = unknown; + +export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get public tracking URL + */ + +export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryOptions(id, options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaPacketsTrackingUrlRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaPacketsTrackingUrlRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaPacketsTrackingUrlRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaPacketsTrackingUrlRetrieveQueryError = unknown; + +export function useApiZasilkovnaPacketsTrackingUrlRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsTrackingUrlRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaPacketsTrackingUrlRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get public tracking URL + */ + +export function useApiZasilkovnaPacketsTrackingUrlRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaPacketsTrackingUrlRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/private/packeta-shipment/packeta-shipment.ts b/frontend/src/api/generated/private/packeta-shipment/packeta-shipment.ts new file mode 100644 index 0000000..5a263ad --- /dev/null +++ b/frontend/src/api/generated/private/packeta-shipment/packeta-shipment.ts @@ -0,0 +1,719 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiZasilkovnaShipmentsListParams, + PaginatedZasilkovnaShipmentList, + ZasilkovnaShipment, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +/** + * Returns a paginated list of Packeta (Zásilkovna) shipments. + * @summary Hromadný shipment + */ +export const apiZasilkovnaShipmentsList = ( + params?: ApiZasilkovnaShipmentsListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/zasilkovna/shipments/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiZasilkovnaShipmentsListInfiniteQueryKey = ( + params?: ApiZasilkovnaShipmentsListParams, +) => { + return [ + "infinite", + `/api/zasilkovna/shipments/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiZasilkovnaShipmentsListQueryKey = ( + params?: ApiZasilkovnaShipmentsListParams, +) => { + return [`/api/zasilkovna/shipments/`, ...(params ? [params] : [])] as const; +}; + +export const getApiZasilkovnaShipmentsListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiZasilkovnaShipmentsListParams["page"] + >, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaShipmentsListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > = ({ signal, pageParam }) => + apiZasilkovnaShipmentsList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaShipmentsListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaShipmentsListInfiniteQueryError = unknown; + +export function useApiZasilkovnaShipmentsListInfinite< + TData = InfiniteData< + Awaited>, + ApiZasilkovnaShipmentsListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiZasilkovnaShipmentsListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsListInfinite< + TData = InfiniteData< + Awaited>, + ApiZasilkovnaShipmentsListParams["page"] + >, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsListInfinite< + TData = InfiniteData< + Awaited>, + ApiZasilkovnaShipmentsListParams["page"] + >, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Hromadný shipment + */ + +export function useApiZasilkovnaShipmentsListInfinite< + TData = InfiniteData< + Awaited>, + ApiZasilkovnaShipmentsListParams["page"] + >, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiZasilkovnaShipmentsListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaShipmentsListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiZasilkovnaShipmentsListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiZasilkovnaShipmentsListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaShipmentsList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaShipmentsListQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaShipmentsListQueryError = unknown; + +export function useApiZasilkovnaShipmentsList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiZasilkovnaShipmentsListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Hromadný shipment + */ + +export function useApiZasilkovnaShipmentsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiZasilkovnaShipmentsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaShipmentsListQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Returns detail for a single shipment. + * @summary Detail hromadné zásilky + */ +export const apiZasilkovnaShipmentsRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/zasilkovna/shipments/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiZasilkovnaShipmentsRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/zasilkovna/shipments/${id}/`] as const; +}; + +export const getApiZasilkovnaShipmentsRetrieveQueryKey = (id?: number) => { + return [`/api/zasilkovna/shipments/${id}/`] as const; +}; + +export const getApiZasilkovnaShipmentsRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiZasilkovnaShipmentsRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaShipmentsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaShipmentsRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaShipmentsRetrieveInfiniteQueryError = unknown; + +export function useApiZasilkovnaShipmentsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Detail hromadné zásilky + */ + +export function useApiZasilkovnaShipmentsRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaShipmentsRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiZasilkovnaShipmentsRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiZasilkovnaShipmentsRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiZasilkovnaShipmentsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiZasilkovnaShipmentsRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiZasilkovnaShipmentsRetrieveQueryError = unknown; + +export function useApiZasilkovnaShipmentsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiZasilkovnaShipmentsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Detail hromadné zásilky + */ + +export function useApiZasilkovnaShipmentsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiZasilkovnaShipmentsRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/private/product-images/product-images.ts b/frontend/src/api/generated/private/product-images/product-images.ts new file mode 100644 index 0000000..73009be --- /dev/null +++ b/frontend/src/api/generated/private/product-images/product-images.ts @@ -0,0 +1,1092 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiCommerceProductImagesListParams, + PaginatedProductImageList, + PatchedProductImage, + ProductImage, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * @summary List product images (public) + */ +export const apiCommerceProductImagesList = ( + params?: ApiCommerceProductImagesListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/product-images/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiCommerceProductImagesListInfiniteQueryKey = ( + params?: ApiCommerceProductImagesListParams, +) => { + return [ + "infinite", + `/api/commerce/product-images/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceProductImagesListQueryKey = ( + params?: ApiCommerceProductImagesListParams, +) => { + return [ + `/api/commerce/product-images/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceProductImagesListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiCommerceProductImagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceProductImagesListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > = ({ signal, pageParam }) => + apiCommerceProductImagesList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductImagesListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesListInfiniteQueryError = unknown; + +export function useApiCommerceProductImagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductImagesListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiCommerceProductImagesListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductImagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductImagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List product images (public) + */ + +export function useApiCommerceProductImagesListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductImagesListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductImagesListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductImagesListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceProductImagesListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceProductImagesListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceProductImagesList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductImagesListQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesListQueryError = unknown; + +export function useApiCommerceProductImagesList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiCommerceProductImagesListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List product images (public) + */ + +export function useApiCommerceProductImagesList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductImagesListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductImagesListQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Create product image (auth required) + */ +export const apiCommerceProductImagesCreate = ( + productImage: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/product-images/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: productImage, + signal, + }); +}; + +export const getApiCommerceProductImagesCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceProductImagesCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiCommerceProductImagesCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductImagesCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesCreateMutationBody = + NonReadonly; +export type ApiCommerceProductImagesCreateMutationError = unknown; + +/** + * @summary Create product image (auth required) + */ +export const useApiCommerceProductImagesCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceProductImagesCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Retrieve product image (public) + */ +export const apiCommerceProductImagesRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/product-images/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceProductImagesRetrieveInfiniteQueryKey = ( + id?: number, +) => { + return ["infinite", `/api/commerce/product-images/${id}/`] as const; +}; + +export const getApiCommerceProductImagesRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/product-images/${id}/`] as const; +}; + +export const getApiCommerceProductImagesRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceProductImagesRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceProductImagesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductImagesRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceProductImagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve product image (public) + */ + +export function useApiCommerceProductImagesRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductImagesRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceProductImagesRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceProductImagesRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceProductImagesRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductImagesRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesRetrieveQueryError = unknown; + +export function useApiCommerceProductImagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductImagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve product image (public) + */ + +export function useApiCommerceProductImagesRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductImagesRetrieveQueryOptions( + id, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Replace product image (auth required) + */ +export const apiCommerceProductImagesUpdate = ( + id: number, + productImage: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/product-images/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: productImage, + }); +}; + +export const getApiCommerceProductImagesUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceProductImagesUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceProductImagesUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductImagesUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesUpdateMutationBody = + NonReadonly; +export type ApiCommerceProductImagesUpdateMutationError = unknown; + +/** + * @summary Replace product image (auth required) + */ +export const useApiCommerceProductImagesUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceProductImagesUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Update product image (auth required) + */ +export const apiCommerceProductImagesPartialUpdate = ( + id: number, + patchedProductImage: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/product-images/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedProductImage, + }); +}; + +export const getApiCommerceProductImagesPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceProductImagesPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceProductImagesPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductImagesPartialUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductImagesPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceProductImagesPartialUpdateMutationError = unknown; + +/** + * @summary Update product image (auth required) + */ +export const useApiCommerceProductImagesPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceProductImagesPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Delete product image (auth required) + */ +export const apiCommerceProductImagesDestroy = (id: number) => { + return privateMutator({ + url: `/api/commerce/product-images/${id}/`, + method: "DELETE", + }); +}; + +export const getApiCommerceProductImagesDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiCommerceProductImagesDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiCommerceProductImagesDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductImagesDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiCommerceProductImagesDestroyMutationError = unknown; + +/** + * @summary Delete product image (auth required) + */ +export const useApiCommerceProductImagesDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = + getApiCommerceProductImagesDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/products/products.ts b/frontend/src/api/generated/private/products/products.ts new file mode 100644 index 0000000..b3fa93a --- /dev/null +++ b/frontend/src/api/generated/private/products/products.ts @@ -0,0 +1,1066 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiCommerceProductsListParams, + PaginatedProductList, + PatchedProduct, + Product, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * @summary List products (public) + */ +export const apiCommerceProductsList = ( + params?: ApiCommerceProductsListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/products/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiCommerceProductsListInfiniteQueryKey = ( + params?: ApiCommerceProductsListParams, +) => { + return [ + "infinite", + `/api/commerce/products/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceProductsListQueryKey = ( + params?: ApiCommerceProductsListParams, +) => { + return [`/api/commerce/products/`, ...(params ? [params] : [])] as const; +}; + +export const getApiCommerceProductsListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiCommerceProductsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductsListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceProductsListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiCommerceProductsListParams["page"] + > = ({ signal, pageParam }) => + apiCommerceProductsList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductsListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductsListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsListInfiniteQueryError = unknown; + +export function useApiCommerceProductsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductsListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiCommerceProductsListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductsListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductsListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductsListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List products (public) + */ + +export function useApiCommerceProductsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceProductsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceProductsListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductsListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceProductsListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceProductsListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceProductsList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductsListQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsListQueryError = unknown; + +export function useApiCommerceProductsList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiCommerceProductsListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List products (public) + */ + +export function useApiCommerceProductsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceProductsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductsListQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Create product (auth required) + */ +export const apiCommerceProductsCreate = ( + product: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/products/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: product, + signal, + }); +}; + +export const getApiCommerceProductsCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceProductsCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiCommerceProductsCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductsCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsCreateMutationBody = NonReadonly; +export type ApiCommerceProductsCreateMutationError = unknown; + +/** + * @summary Create product (auth required) + */ +export const useApiCommerceProductsCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = getApiCommerceProductsCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Retrieve product (public) + */ +export const apiCommerceProductsRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/products/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceProductsRetrieveInfiniteQueryKey = (id?: number) => { + return ["infinite", `/api/commerce/products/${id}/`] as const; +}; + +export const getApiCommerceProductsRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/products/${id}/`] as const; +}; + +export const getApiCommerceProductsRetrieveInfiniteQueryOptions = < + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiCommerceProductsRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceProductsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductsRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceProductsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve product (public) + */ + +export function useApiCommerceProductsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductsRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceProductsRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceProductsRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceProductsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceProductsRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsRetrieveQueryError = unknown; + +export function useApiCommerceProductsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceProductsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve product (public) + */ + +export function useApiCommerceProductsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceProductsRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Replace product (auth required) + */ +export const apiCommerceProductsUpdate = ( + id: number, + product: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/products/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: product, + }); +}; + +export const getApiCommerceProductsUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceProductsUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceProductsUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductsUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsUpdateMutationBody = NonReadonly; +export type ApiCommerceProductsUpdateMutationError = unknown; + +/** + * @summary Replace product (auth required) + */ +export const useApiCommerceProductsUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = getApiCommerceProductsUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Update product (auth required) + */ +export const apiCommerceProductsPartialUpdate = ( + id: number, + patchedProduct: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/products/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedProduct, + }); +}; + +export const getApiCommerceProductsPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceProductsPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceProductsPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductsPartialUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceProductsPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceProductsPartialUpdateMutationError = unknown; + +/** + * @summary Update product (auth required) + */ +export const useApiCommerceProductsPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceProductsPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Delete product (auth required) + */ +export const apiCommerceProductsDestroy = (id: number) => { + return privateMutator({ + url: `/api/commerce/products/${id}/`, + method: "DELETE", + }); +}; + +export const getApiCommerceProductsDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiCommerceProductsDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiCommerceProductsDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceProductsDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiCommerceProductsDestroyMutationError = unknown; + +/** + * @summary Delete product (auth required) + */ +export const useApiCommerceProductsDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = getApiCommerceProductsDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/refunds/refunds.ts b/frontend/src/api/generated/private/refunds/refunds.ts new file mode 100644 index 0000000..704e4cf --- /dev/null +++ b/frontend/src/api/generated/private/refunds/refunds.ts @@ -0,0 +1,1064 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiCommerceRefundsListParams, + PaginatedRefundList, + PatchedRefund, + Refund, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * @summary List refunds (admin) + */ +export const apiCommerceRefundsList = ( + params?: ApiCommerceRefundsListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/refunds/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiCommerceRefundsListInfiniteQueryKey = ( + params?: ApiCommerceRefundsListParams, +) => { + return [ + "infinite", + `/api/commerce/refunds/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiCommerceRefundsListQueryKey = ( + params?: ApiCommerceRefundsListParams, +) => { + return [`/api/commerce/refunds/`, ...(params ? [params] : [])] as const; +}; + +export const getApiCommerceRefundsListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiCommerceRefundsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceRefundsListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceRefundsListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiCommerceRefundsListParams["page"] + > = ({ signal, pageParam }) => + apiCommerceRefundsList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceRefundsListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiCommerceRefundsListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsListInfiniteQueryError = unknown; + +export function useApiCommerceRefundsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceRefundsListParams["page"] + >, + TError = unknown, +>( + params: undefined | ApiCommerceRefundsListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceRefundsListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceRefundsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceRefundsListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceRefundsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceRefundsListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List refunds (admin) + */ + +export function useApiCommerceRefundsListInfinite< + TData = InfiniteData< + Awaited>, + ApiCommerceRefundsListParams["page"] + >, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiCommerceRefundsListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceRefundsListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceRefundsListQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceRefundsListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceRefundsList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceRefundsListQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsListQueryError = unknown; + +export function useApiCommerceRefundsList< + TData = Awaited>, + TError = unknown, +>( + params: undefined | ApiCommerceRefundsListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List refunds (admin) + */ + +export function useApiCommerceRefundsList< + TData = Awaited>, + TError = unknown, +>( + params?: ApiCommerceRefundsListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceRefundsListQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Create refund (admin) + */ +export const apiCommerceRefundsCreate = ( + refund: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/refunds/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: refund, + signal, + }); +}; + +export const getApiCommerceRefundsCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceRefundsCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiCommerceRefundsCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceRefundsCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsCreateMutationBody = NonReadonly; +export type ApiCommerceRefundsCreateMutationError = unknown; + +/** + * @summary Create refund (admin) + */ +export const useApiCommerceRefundsCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = getApiCommerceRefundsCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Retrieve refund (admin) + */ +export const apiCommerceRefundsRetrieve = ( + id: number, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/commerce/refunds/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiCommerceRefundsRetrieveInfiniteQueryKey = (id?: number) => { + return ["infinite", `/api/commerce/refunds/${id}/`] as const; +}; + +export const getApiCommerceRefundsRetrieveQueryKey = (id?: number) => { + return [`/api/commerce/refunds/${id}/`] as const; +}; + +export const getApiCommerceRefundsRetrieveInfiniteQueryOptions = < + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceRefundsRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceRefundsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceRefundsRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsRetrieveInfiniteQueryError = unknown; + +export function useApiCommerceRefundsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve refund (admin) + */ + +export function useApiCommerceRefundsRetrieveInfinite< + TData = InfiniteData>>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceRefundsRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiCommerceRefundsRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiCommerceRefundsRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiCommerceRefundsRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiCommerceRefundsRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsRetrieveQueryError = unknown; + +export function useApiCommerceRefundsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiCommerceRefundsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Retrieve refund (admin) + */ + +export function useApiCommerceRefundsRetrieve< + TData = Awaited>, + TError = unknown, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiCommerceRefundsRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Replace refund (admin) + */ +export const apiCommerceRefundsUpdate = ( + id: number, + refund: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/refunds/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: refund, + }); +}; + +export const getApiCommerceRefundsUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceRefundsUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceRefundsUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceRefundsUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsUpdateMutationBody = NonReadonly; +export type ApiCommerceRefundsUpdateMutationError = unknown; + +/** + * @summary Replace refund (admin) + */ +export const useApiCommerceRefundsUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = getApiCommerceRefundsUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Update refund (admin) + */ +export const apiCommerceRefundsPartialUpdate = ( + id: number, + patchedRefund: NonReadonly, +) => { + return privateMutator({ + url: `/api/commerce/refunds/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedRefund, + }); +}; + +export const getApiCommerceRefundsPartialUpdateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiCommerceRefundsPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiCommerceRefundsPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceRefundsPartialUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiCommerceRefundsPartialUpdateMutationBody = + NonReadonly; +export type ApiCommerceRefundsPartialUpdateMutationError = unknown; + +/** + * @summary Update refund (admin) + */ +export const useApiCommerceRefundsPartialUpdate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiCommerceRefundsPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * @summary Delete refund (admin) + */ +export const apiCommerceRefundsDestroy = (id: number) => { + return privateMutator({ + url: `/api/commerce/refunds/${id}/`, + method: "DELETE", + }); +}; + +export const getApiCommerceRefundsDestroyMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiCommerceRefundsDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiCommerceRefundsDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiCommerceRefundsDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiCommerceRefundsDestroyMutationError = unknown; + +/** + * @summary Delete refund (admin) + */ +export const useApiCommerceRefundsDestroy = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = getApiCommerceRefundsDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/stripe/stripe.ts b/frontend/src/api/generated/private/stripe/stripe.ts new file mode 100644 index 0000000..d83bbc9 --- /dev/null +++ b/frontend/src/api/generated/private/stripe/stripe.ts @@ -0,0 +1,88 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useMutation } from "@tanstack/react-query"; +import type { + MutationFunction, + QueryClient, + UseMutationOptions, + UseMutationResult, +} from "@tanstack/react-query"; + +import { privateMutator } from "../../../privateClient"; + +export const apiStripeStripeWebhookCreate = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/stripe/stripe-webhook/`, + method: "POST", + signal, + }); +}; + +export const getApiStripeStripeWebhookCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const mutationKey = ["apiStripeStripeWebhookCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return apiStripeStripeWebhookCreate(); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiStripeStripeWebhookCreateMutationResult = NonNullable< + Awaited> +>; + +export type ApiStripeStripeWebhookCreateMutationError = unknown; + +export const useApiStripeStripeWebhookCreate = < + TError = unknown, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + void, + TContext +> => { + const mutationOptions = + getApiStripeStripeWebhookCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/trading212/trading212.ts b/frontend/src/api/generated/private/trading212/trading212.ts new file mode 100644 index 0000000..a5d9621 --- /dev/null +++ b/frontend/src/api/generated/private/trading212/trading212.ts @@ -0,0 +1,622 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import { privateMutator } from "../../../privateClient"; + +/** + * @summary Get Trading212 account cash + */ +export const apiTrading212EquityCashRetrieve = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/trading212/equity/cash/`, + method: "GET", + signal, + }); +}; + +export const getApiTrading212EquityCashRetrieveInfiniteQueryKey = () => { + return ["infinite", `/api/trading212/equity/cash/`] as const; +}; + +export const getApiTrading212EquityCashRetrieveQueryKey = () => { + return [`/api/trading212/equity/cash/`] as const; +}; + +export const getApiTrading212EquityCashRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>(options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiTrading212EquityCashRetrieveInfiniteQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiTrading212EquityCashRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiTrading212EquityCashRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiTrading212EquityCashRetrieveInfiniteQueryError = unknown; + +export function useApiTrading212EquityCashRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquityCashRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquityCashRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Trading212 account cash + */ + +export function useApiTrading212EquityCashRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiTrading212EquityCashRetrieveInfiniteQueryOptions(options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiTrading212EquityCashRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiTrading212EquityCashRetrieveQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiTrading212EquityCashRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiTrading212EquityCashRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiTrading212EquityCashRetrieveQueryError = unknown; + +export function useApiTrading212EquityCashRetrieve< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquityCashRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquityCashRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Trading212 account cash + */ + +export function useApiTrading212EquityCashRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiTrading212EquityCashRetrieveQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Get Trading212 account summary + */ +export const apiTrading212EquitySummaryRetrieve = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/trading212/equity/summary/`, + method: "GET", + signal, + }); +}; + +export const getApiTrading212EquitySummaryRetrieveInfiniteQueryKey = () => { + return ["infinite", `/api/trading212/equity/summary/`] as const; +}; + +export const getApiTrading212EquitySummaryRetrieveQueryKey = () => { + return [`/api/trading212/equity/summary/`] as const; +}; + +export const getApiTrading212EquitySummaryRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>(options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiTrading212EquitySummaryRetrieveInfiniteQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiTrading212EquitySummaryRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiTrading212EquitySummaryRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiTrading212EquitySummaryRetrieveInfiniteQueryError = unknown; + +export function useApiTrading212EquitySummaryRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquitySummaryRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquitySummaryRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Trading212 account summary + */ + +export function useApiTrading212EquitySummaryRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = unknown, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiTrading212EquitySummaryRetrieveInfiniteQueryOptions(options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiTrading212EquitySummaryRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiTrading212EquitySummaryRetrieveQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiTrading212EquitySummaryRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiTrading212EquitySummaryRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiTrading212EquitySummaryRetrieveQueryError = unknown; + +export function useApiTrading212EquitySummaryRetrieve< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquitySummaryRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiTrading212EquitySummaryRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get Trading212 account summary + */ + +export function useApiTrading212EquitySummaryRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = + getApiTrading212EquitySummaryRetrieveQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/private/user-password-reset/user-password-reset.ts b/frontend/src/api/generated/private/user-password-reset/user-password-reset.ts new file mode 100644 index 0000000..f6447ba --- /dev/null +++ b/frontend/src/api/generated/private/user-password-reset/user-password-reset.ts @@ -0,0 +1,194 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useMutation } from "@tanstack/react-query"; +import type { + MutationFunction, + QueryClient, + UseMutationOptions, + UseMutationResult, +} from "@tanstack/react-query"; + +import type { PasswordResetConfirm, PasswordResetRequest } from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +/** + * Request password reset by providing registered email. An email with instructions will be sent. + * @summary Request password reset (send email) + */ +export const apiAccountPasswordResetCreate = ( + passwordResetRequest: PasswordResetRequest, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/account/password-reset/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: passwordResetRequest, + signal, + }); +}; + +export const getApiAccountPasswordResetCreateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: PasswordResetRequest }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: PasswordResetRequest }, + TContext +> => { + const mutationKey = ["apiAccountPasswordResetCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: PasswordResetRequest } + > = (props) => { + const { data } = props ?? {}; + + return apiAccountPasswordResetCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountPasswordResetCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountPasswordResetCreateMutationBody = PasswordResetRequest; +export type ApiAccountPasswordResetCreateMutationError = void; + +/** + * @summary Request password reset (send email) + */ +export const useApiAccountPasswordResetCreate = < + TError = void, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: PasswordResetRequest }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: PasswordResetRequest }, + TContext +> => { + const mutationOptions = + getApiAccountPasswordResetCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Confirm password reset using token from email. + * @summary Confirm password reset via token + */ +export const apiAccountPasswordResetConfirmCreate = ( + uidb64: string, + token: string, + passwordResetConfirm: PasswordResetConfirm, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/account/password-reset-confirm/${uidb64}/${token}/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: passwordResetConfirm, + signal, + }); +}; + +export const getApiAccountPasswordResetConfirmCreateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { uidb64: string; token: string; data: PasswordResetConfirm }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { uidb64: string; token: string; data: PasswordResetConfirm }, + TContext +> => { + const mutationKey = ["apiAccountPasswordResetConfirmCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { uidb64: string; token: string; data: PasswordResetConfirm } + > = (props) => { + const { uidb64, token, data } = props ?? {}; + + return apiAccountPasswordResetConfirmCreate(uidb64, token, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountPasswordResetConfirmCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountPasswordResetConfirmCreateMutationBody = + PasswordResetConfirm; +export type ApiAccountPasswordResetConfirmCreateMutationError = void; + +/** + * @summary Confirm password reset via token + */ +export const useApiAccountPasswordResetConfirmCreate = < + TError = void, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { uidb64: string; token: string; data: PasswordResetConfirm }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { uidb64: string; token: string; data: PasswordResetConfirm }, + TContext +> => { + const mutationOptions = + getApiAccountPasswordResetConfirmCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/private/user-registration/user-registration.ts b/frontend/src/api/generated/private/user-registration/user-registration.ts new file mode 100644 index 0000000..933b7a2 --- /dev/null +++ b/frontend/src/api/generated/private/user-registration/user-registration.ts @@ -0,0 +1,463 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { UserRegistration } from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +/** + * Register a new user (company or individual). The user will receive an email with a verification link. + * @summary Register a new user (company or individual) + */ +export const apiAccountRegisterCreate = ( + userRegistration: UserRegistration, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/account/register/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: userRegistration, + signal, + }); +}; + +export const getApiAccountRegisterCreateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: UserRegistration }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: UserRegistration }, + TContext +> => { + const mutationKey = ["apiAccountRegisterCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: UserRegistration } + > = (props) => { + const { data } = props ?? {}; + + return apiAccountRegisterCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountRegisterCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountRegisterCreateMutationBody = UserRegistration; +export type ApiAccountRegisterCreateMutationError = void; + +/** + * @summary Register a new user (company or individual) + */ +export const useApiAccountRegisterCreate = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: UserRegistration }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: UserRegistration }, + TContext +> => { + const mutationOptions = getApiAccountRegisterCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Verify user email using the link with uid and token. + * @summary Verify user email via link + */ +export const apiAccountVerifyEmailRetrieve = ( + uidb64: string, + token: string, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/account/verify-email/${uidb64}/${token}/`, + method: "GET", + signal, + }); +}; + +export const getApiAccountVerifyEmailRetrieveInfiniteQueryKey = ( + uidb64?: string, + token?: string, +) => { + return ["infinite", `/api/account/verify-email/${uidb64}/${token}/`] as const; +}; + +export const getApiAccountVerifyEmailRetrieveQueryKey = ( + uidb64?: string, + token?: string, +) => { + return [`/api/account/verify-email/${uidb64}/${token}/`] as const; +}; + +export const getApiAccountVerifyEmailRetrieveInfiniteQueryOptions = < + TData = InfiniteData< + Awaited> + >, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiAccountVerifyEmailRetrieveInfiniteQueryKey(uidb64, token); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountVerifyEmailRetrieve(uidb64, token, signal); + + return { + queryKey, + queryFn, + enabled: !!(uidb64 && token), + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountVerifyEmailRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountVerifyEmailRetrieveInfiniteQueryError = void; + +export function useApiAccountVerifyEmailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = void, +>( + uidb64: string, + token: string, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountVerifyEmailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountVerifyEmailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Verify user email via link + */ + +export function useApiAccountVerifyEmailRetrieveInfinite< + TData = InfiniteData< + Awaited> + >, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountVerifyEmailRetrieveInfiniteQueryOptions( + uidb64, + token, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiAccountVerifyEmailRetrieveQueryOptions = < + TData = Awaited>, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? + getApiAccountVerifyEmailRetrieveQueryKey(uidb64, token); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountVerifyEmailRetrieve(uidb64, token, signal); + + return { + queryKey, + queryFn, + enabled: !!(uidb64 && token), + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountVerifyEmailRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountVerifyEmailRetrieveQueryError = void; + +export function useApiAccountVerifyEmailRetrieve< + TData = Awaited>, + TError = void, +>( + uidb64: string, + token: string, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountVerifyEmailRetrieve< + TData = Awaited>, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountVerifyEmailRetrieve< + TData = Awaited>, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Verify user email via link + */ + +export function useApiAccountVerifyEmailRetrieve< + TData = Awaited>, + TError = void, +>( + uidb64: string, + token: string, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountVerifyEmailRetrieveQueryOptions( + uidb64, + token, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/private/user/user.ts b/frontend/src/api/generated/private/user/user.ts new file mode 100644 index 0000000..3d0a72e --- /dev/null +++ b/frontend/src/api/generated/private/user/user.ts @@ -0,0 +1,1346 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseInfiniteQueryResult, + DefinedUseQueryResult, + InfiniteData, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseInfiniteQueryOptions, + UseInfiniteQueryResult, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiAccountUsersListParams, + CustomUser, + PaginatedCustomUserList, + PatchedCustomUser, +} from ".././models"; + +import { privateMutator } from "../../../privateClient"; + +// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497 +type IfEquals = + (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +type WritableKeys = { + [P in keyof T]-?: IfEquals< + { [Q in P]: T[P] }, + { -readonly [Q in P]: T[P] }, + P + >; +}[keyof T]; + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; +type DistributeReadOnlyOverUnions = T extends any ? NonReadonly : never; + +type Writable = Pick>; +type NonReadonly = [T] extends [UnionToIntersection] + ? { + [P in keyof Writable]: T[P] extends object + ? NonReadonly> + : T[P]; + } + : DistributeReadOnlyOverUnions; + +/** + * Returns details of the currently authenticated user based on JWT token or session. + * @summary Get current authenticated user + */ +export const apiAccountUserMeRetrieve = (signal?: AbortSignal) => { + return privateMutator({ + url: `/api/account/user/me/`, + method: "GET", + signal, + }); +}; + +export const getApiAccountUserMeRetrieveInfiniteQueryKey = () => { + return ["infinite", `/api/account/user/me/`] as const; +}; + +export const getApiAccountUserMeRetrieveQueryKey = () => { + return [`/api/account/user/me/`] as const; +}; + +export const getApiAccountUserMeRetrieveInfiniteQueryOptions = < + TData = InfiniteData>>, + TError = void, +>(options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiAccountUserMeRetrieveInfiniteQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountUserMeRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountUserMeRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountUserMeRetrieveInfiniteQueryError = void; + +export function useApiAccountUserMeRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUserMeRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUserMeRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get current authenticated user + */ + +export function useApiAccountUserMeRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountUserMeRetrieveInfiniteQueryOptions(options); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiAccountUserMeRetrieveQueryOptions = < + TData = Awaited>, + TError = void, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiAccountUserMeRetrieveQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountUserMeRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountUserMeRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountUserMeRetrieveQueryError = void; + +export function useApiAccountUserMeRetrieve< + TData = Awaited>, + TError = void, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUserMeRetrieve< + TData = Awaited>, + TError = void, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUserMeRetrieve< + TData = Awaited>, + TError = void, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get current authenticated user + */ + +export function useApiAccountUserMeRetrieve< + TData = Awaited>, + TError = void, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountUserMeRetrieveQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Displays all users with filtering and ordering options. Requires authentication and appropriate role. + * @summary List, retrieve, update, and delete users. + */ +export const apiAccountUsersList = ( + params?: ApiAccountUsersListParams, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/account/users/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiAccountUsersListInfiniteQueryKey = ( + params?: ApiAccountUsersListParams, +) => { + return [ + "infinite", + `/api/account/users/`, + ...(params ? [params] : []), + ] as const; +}; + +export const getApiAccountUsersListQueryKey = ( + params?: ApiAccountUsersListParams, +) => { + return [`/api/account/users/`, ...(params ? [params] : [])] as const; +}; + +export const getApiAccountUsersListInfiniteQueryOptions = < + TData = InfiniteData< + Awaited>, + ApiAccountUsersListParams["page"] + >, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAccountUsersListParams["page"] + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiAccountUsersListInfiniteQueryKey(params); + + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ApiAccountUsersListParams["page"] + > = ({ signal, pageParam }) => + apiAccountUsersList( + { ...params, page: pageParam || params?.["page"] }, + signal, + ); + + return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAccountUsersListParams["page"] + > & { queryKey: DataTag }; +}; + +export type ApiAccountUsersListInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersListInfiniteQueryError = void; + +export function useApiAccountUsersListInfinite< + TData = InfiniteData< + Awaited>, + ApiAccountUsersListParams["page"] + >, + TError = void, +>( + params: undefined | ApiAccountUsersListParams, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAccountUsersListParams["page"] + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersListInfinite< + TData = InfiniteData< + Awaited>, + ApiAccountUsersListParams["page"] + >, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAccountUsersListParams["page"] + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited>, + QueryKey + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersListInfinite< + TData = InfiniteData< + Awaited>, + ApiAccountUsersListParams["page"] + >, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAccountUsersListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List, retrieve, update, and delete users. + */ + +export function useApiAccountUsersListInfinite< + TData = InfiniteData< + Awaited>, + ApiAccountUsersListParams["page"] + >, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + QueryKey, + ApiAccountUsersListParams["page"] + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountUsersListInfiniteQueryOptions( + params, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiAccountUsersListQueryOptions = < + TData = Awaited>, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiAccountUsersListQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountUsersList(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountUsersListQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersListQueryError = void; + +export function useApiAccountUsersList< + TData = Awaited>, + TError = void, +>( + params: undefined | ApiAccountUsersListParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersList< + TData = Awaited>, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersList< + TData = Awaited>, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List, retrieve, update, and delete users. + */ + +export function useApiAccountUsersList< + TData = Awaited>, + TError = void, +>( + params?: ApiAccountUsersListParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountUsersListQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Displays all users with filtering and ordering options. Requires authentication and appropriate role. + * @summary List, retrieve, update, and delete users. + */ +export const apiAccountUsersCreate = ( + customUser: NonReadonly, + signal?: AbortSignal, +) => { + return privateMutator({ + url: `/api/account/users/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: customUser, + signal, + }); +}; + +export const getApiAccountUsersCreateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiAccountUsersCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: NonReadonly } + > = (props) => { + const { data } = props ?? {}; + + return apiAccountUsersCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountUsersCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersCreateMutationBody = NonReadonly; +export type ApiAccountUsersCreateMutationError = void; + +/** + * @summary List, retrieve, update, and delete users. + */ +export const useApiAccountUsersCreate = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: NonReadonly }, + TContext +> => { + const mutationOptions = getApiAccountUsersCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Displays all users with filtering and ordering options. Requires authentication and appropriate role. + * @summary List, retrieve, update, and delete users. + */ +export const apiAccountUsersRetrieve = (id: number, signal?: AbortSignal) => { + return privateMutator({ + url: `/api/account/users/${id}/`, + method: "GET", + signal, + }); +}; + +export const getApiAccountUsersRetrieveInfiniteQueryKey = (id?: number) => { + return ["infinite", `/api/account/users/${id}/`] as const; +}; + +export const getApiAccountUsersRetrieveQueryKey = (id?: number) => { + return [`/api/account/users/${id}/`] as const; +}; + +export const getApiAccountUsersRetrieveInfiniteQueryOptions = < + TData = InfiniteData>>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiAccountUsersRetrieveInfiniteQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountUsersRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountUsersRetrieveInfiniteQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersRetrieveInfiniteQueryError = void; + +export function useApiAccountUsersRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + id: number, + options: { + query: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List, retrieve, update, and delete users. + */ + +export function useApiAccountUsersRetrieveInfinite< + TData = InfiniteData>>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseInfiniteQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountUsersRetrieveInfiniteQueryOptions( + id, + options, + ); + + const query = useInfiniteQuery( + queryOptions, + queryClient, + ) as UseInfiniteQueryResult & { + queryKey: DataTag; + }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const getApiAccountUsersRetrieveQueryOptions = < + TData = Awaited>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiAccountUsersRetrieveQueryKey(id); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiAccountUsersRetrieve(id, signal); + + return { + queryKey, + queryFn, + enabled: !!id, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiAccountUsersRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersRetrieveQueryError = void; + +export function useApiAccountUsersRetrieve< + TData = Awaited>, + TError = void, +>( + id: number, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersRetrieve< + TData = Awaited>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiAccountUsersRetrieve< + TData = Awaited>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary List, retrieve, update, and delete users. + */ + +export function useApiAccountUsersRetrieve< + TData = Awaited>, + TError = void, +>( + id: number, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiAccountUsersRetrieveQueryOptions(id, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * Displays all users with filtering and ordering options. Requires authentication and appropriate role. + * @summary List, retrieve, update, and delete users. + */ +export const apiAccountUsersUpdate = ( + id: number, + customUser: NonReadonly, +) => { + return privateMutator({ + url: `/api/account/users/${id}/`, + method: "PUT", + headers: { "Content-Type": "application/json" }, + data: customUser, + }); +}; + +export const getApiAccountUsersUpdateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiAccountUsersUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiAccountUsersUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountUsersUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersUpdateMutationBody = NonReadonly; +export type ApiAccountUsersUpdateMutationError = void; + +/** + * @summary List, retrieve, update, and delete users. + */ +export const useApiAccountUsersUpdate = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = getApiAccountUsersUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Displays all users with filtering and ordering options. Requires authentication and appropriate role. + * @summary List, retrieve, update, and delete users. + */ +export const apiAccountUsersPartialUpdate = ( + id: number, + patchedCustomUser: NonReadonly, +) => { + return privateMutator({ + url: `/api/account/users/${id}/`, + method: "PATCH", + headers: { "Content-Type": "application/json" }, + data: patchedCustomUser, + }); +}; + +export const getApiAccountUsersPartialUpdateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationKey = ["apiAccountUsersPartialUpdate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number; data: NonReadonly } + > = (props) => { + const { id, data } = props ?? {}; + + return apiAccountUsersPartialUpdate(id, data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountUsersPartialUpdateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountUsersPartialUpdateMutationBody = + NonReadonly; +export type ApiAccountUsersPartialUpdateMutationError = void; + +/** + * @summary List, retrieve, update, and delete users. + */ +export const useApiAccountUsersPartialUpdate = < + TError = void, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number; data: NonReadonly }, + TContext +> => { + const mutationOptions = + getApiAccountUsersPartialUpdateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Displays all users with filtering and ordering options. Requires authentication and appropriate role. + * @summary List, retrieve, update, and delete users. + */ +export const apiAccountUsersDestroy = (id: number) => { + return privateMutator({ + url: `/api/account/users/${id}/`, + method: "DELETE", + }); +}; + +export const getApiAccountUsersDestroyMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationKey = ["apiAccountUsersDestroy"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { id: number } + > = (props) => { + const { id } = props ?? {}; + + return apiAccountUsersDestroy(id); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountUsersDestroyMutationResult = NonNullable< + Awaited> +>; + +export type ApiAccountUsersDestroyMutationError = void; + +/** + * @summary List, retrieve, update, and delete users. + */ +export const useApiAccountUsersDestroy = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { id: number }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { id: number }, + TContext +> => { + const mutationOptions = getApiAccountUsersDestroyMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/public/authentication.ts b/frontend/src/api/generated/public/authentication.ts new file mode 100644 index 0000000..e8bc5ca --- /dev/null +++ b/frontend/src/api/generated/public/authentication.ts @@ -0,0 +1,256 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useMutation } from "@tanstack/react-query"; +import type { + MutationFunction, + QueryClient, + UseMutationOptions, + UseMutationResult, +} from "@tanstack/react-query"; + +import type { CustomTokenObtainPair } from "./models"; + +import { publicMutator } from "../../publicClient"; + +/** + * Authenticate user and obtain JWT access and refresh tokens. You can use either email or username. + * @summary Obtain JWT access and refresh tokens (cookie-based) + */ +export const apiAccountLoginCreate = ( + customTokenObtainPair: CustomTokenObtainPair, + signal?: AbortSignal, +) => { + return publicMutator({ + url: `/api/account/login/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: customTokenObtainPair, + signal, + }); +}; + +export const getApiAccountLoginCreateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: CustomTokenObtainPair }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: CustomTokenObtainPair }, + TContext +> => { + const mutationKey = ["apiAccountLoginCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: CustomTokenObtainPair } + > = (props) => { + const { data } = props ?? {}; + + return apiAccountLoginCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountLoginCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiAccountLoginCreateMutationBody = CustomTokenObtainPair; +export type ApiAccountLoginCreateMutationError = void; + +/** + * @summary Obtain JWT access and refresh tokens (cookie-based) + */ +export const useApiAccountLoginCreate = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: CustomTokenObtainPair }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: CustomTokenObtainPair }, + TContext +> => { + const mutationOptions = getApiAccountLoginCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Logs out the user by deleting access and refresh token cookies. + * @summary Logout user (delete access and refresh token cookies) + */ +export const apiAccountLogoutCreate = (signal?: AbortSignal) => { + return publicMutator({ + url: `/api/account/logout/`, + method: "POST", + signal, + }); +}; + +export const getApiAccountLogoutCreateMutationOptions = < + TError = unknown, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const mutationKey = ["apiAccountLogoutCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return apiAccountLogoutCreate(); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountLogoutCreateMutationResult = NonNullable< + Awaited> +>; + +export type ApiAccountLogoutCreateMutationError = unknown; + +/** + * @summary Logout user (delete access and refresh token cookies) + */ +export const useApiAccountLogoutCreate = ( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + void, + TContext +> => { + const mutationOptions = getApiAccountLogoutCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Refresh JWT access and refresh tokens using the refresh token stored in cookie. + * @summary Refresh JWT token using cookie + */ +export const apiAccountTokenRefreshCreate = (signal?: AbortSignal) => { + return publicMutator({ + url: `/api/account/token/refresh/`, + method: "POST", + signal, + }); +}; + +export const getApiAccountTokenRefreshCreateMutationOptions = < + TError = void, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + void, + TContext +> => { + const mutationKey = ["apiAccountTokenRefreshCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + void + > = () => { + return apiAccountTokenRefreshCreate(); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiAccountTokenRefreshCreateMutationResult = NonNullable< + Awaited> +>; + +export type ApiAccountTokenRefreshCreateMutationError = void; + +/** + * @summary Refresh JWT token using cookie + */ +export const useApiAccountTokenRefreshCreate = < + TError = void, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + void, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + void, + TContext +> => { + const mutationOptions = + getApiAccountTokenRefreshCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; diff --git a/frontend/src/api/generated/public/downloader.ts b/frontend/src/api/generated/public/downloader.ts new file mode 100644 index 0000000..9773093 --- /dev/null +++ b/frontend/src/api/generated/public/downloader.ts @@ -0,0 +1,431 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useMutation, useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { + ApiDownloaderDownloadRetrieveParams, + DownloadErrorResponse, + DownloadRequest, + DownloaderStats, + ErrorResponse, + VideoInfoResponse, +} from "./models"; + +import { publicMutator } from "../../publicClient"; + +/** + * @summary Get video info from URL + */ +export const apiDownloaderDownloadRetrieve = ( + params: ApiDownloaderDownloadRetrieveParams, + signal?: AbortSignal, +) => { + return publicMutator({ + url: `/api/downloader/download/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiDownloaderDownloadRetrieveQueryKey = ( + params?: ApiDownloaderDownloadRetrieveParams, +) => { + return [`/api/downloader/download/`, ...(params ? [params] : [])] as const; +}; + +export const getApiDownloaderDownloadRetrieveQueryOptions = < + TData = Awaited>, + TError = ErrorResponse, +>( + params: ApiDownloaderDownloadRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiDownloaderDownloadRetrieveQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiDownloaderDownloadRetrieve(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiDownloaderDownloadRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiDownloaderDownloadRetrieveQueryError = ErrorResponse; + +export function useApiDownloaderDownloadRetrieve< + TData = Awaited>, + TError = ErrorResponse, +>( + params: ApiDownloaderDownloadRetrieveParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiDownloaderDownloadRetrieve< + TData = Awaited>, + TError = ErrorResponse, +>( + params: ApiDownloaderDownloadRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiDownloaderDownloadRetrieve< + TData = Awaited>, + TError = ErrorResponse, +>( + params: ApiDownloaderDownloadRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get video info from URL + */ + +export function useApiDownloaderDownloadRetrieve< + TData = Awaited>, + TError = ErrorResponse, +>( + params: ApiDownloaderDownloadRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiDownloaderDownloadRetrieveQueryOptions( + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary Download video from URL + */ +export const apiDownloaderDownloadCreate = ( + downloadRequest: DownloadRequest, + signal?: AbortSignal, +) => { + return publicMutator({ + url: `/api/downloader/download/`, + method: "POST", + headers: { "Content-Type": "application/json" }, + data: downloadRequest, + responseType: "blob", + signal, + }); +}; + +export const getApiDownloaderDownloadCreateMutationOptions = < + TError = DownloadErrorResponse, + TContext = unknown, +>(options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: DownloadRequest }, + TContext + >; +}): UseMutationOptions< + Awaited>, + TError, + { data: DownloadRequest }, + TContext +> => { + const mutationKey = ["apiDownloaderDownloadCreate"]; + const { mutation: mutationOptions } = options + ? options.mutation && + "mutationKey" in options.mutation && + options.mutation.mutationKey + ? options + : { ...options, mutation: { ...options.mutation, mutationKey } } + : { mutation: { mutationKey } }; + + const mutationFn: MutationFunction< + Awaited>, + { data: DownloadRequest } + > = (props) => { + const { data } = props ?? {}; + + return apiDownloaderDownloadCreate(data); + }; + + return { mutationFn, ...mutationOptions }; +}; + +export type ApiDownloaderDownloadCreateMutationResult = NonNullable< + Awaited> +>; +export type ApiDownloaderDownloadCreateMutationBody = DownloadRequest; +export type ApiDownloaderDownloadCreateMutationError = DownloadErrorResponse; + +/** + * @summary Download video from URL + */ +export const useApiDownloaderDownloadCreate = < + TError = DownloadErrorResponse, + TContext = unknown, +>( + options?: { + mutation?: UseMutationOptions< + Awaited>, + TError, + { data: DownloadRequest }, + TContext + >; + }, + queryClient?: QueryClient, +): UseMutationResult< + Awaited>, + TError, + { data: DownloadRequest }, + TContext +> => { + const mutationOptions = + getApiDownloaderDownloadCreateMutationOptions(options); + + return useMutation(mutationOptions, queryClient); +}; +/** + * Vrací agregované statistiky z tabulky DownloaderRecord. + * @summary Get aggregated downloader statistics + */ +export const apiDownloaderStatsRetrieve = (signal?: AbortSignal) => { + return publicMutator({ + url: `/api/downloader/stats/`, + method: "GET", + signal, + }); +}; + +export const getApiDownloaderStatsRetrieveQueryKey = () => { + return [`/api/downloader/stats/`] as const; +}; + +export const getApiDownloaderStatsRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>(options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; +}) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiDownloaderStatsRetrieveQueryKey(); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiDownloaderStatsRetrieve(signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiDownloaderStatsRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiDownloaderStatsRetrieveQueryError = unknown; + +export function useApiDownloaderStatsRetrieve< + TData = Awaited>, + TError = unknown, +>( + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiDownloaderStatsRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiDownloaderStatsRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary Get aggregated downloader statistics + */ + +export function useApiDownloaderStatsRetrieve< + TData = Awaited>, + TError = unknown, +>( + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiDownloaderStatsRetrieveQueryOptions(options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/api/generated/public/filler b/frontend/src/api/generated/public/filler deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/api/generated/public/models/additionalParam.ts b/frontend/src/api/generated/public/models/additionalParam.ts new file mode 100644 index 0000000..e2a84cb --- /dev/null +++ b/frontend/src/api/generated/public/models/additionalParam.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface AdditionalParam { + name: string; + value: string; +} diff --git a/frontend/src/api/generated/public/models/apiChoicesRetrieve200.ts b/frontend/src/api/generated/public/models/apiChoicesRetrieve200.ts new file mode 100644 index 0000000..86ed6fa --- /dev/null +++ b/frontend/src/api/generated/public/models/apiChoicesRetrieve200.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ApiChoicesRetrieve200Item } from "./apiChoicesRetrieve200Item"; + +export type ApiChoicesRetrieve200 = { + [key: string]: ApiChoicesRetrieve200Item[]; +}; diff --git a/frontend/src/api/generated/public/models/apiChoicesRetrieve200Item.ts b/frontend/src/api/generated/public/models/apiChoicesRetrieve200Item.ts new file mode 100644 index 0000000..3766df4 --- /dev/null +++ b/frontend/src/api/generated/public/models/apiChoicesRetrieve200Item.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiChoicesRetrieve200Item = { + /** Logická hodnota pro backend */ + value?: string; + /** Human-readable label podle zvoleného jazyka */ + label?: string; +}; diff --git a/frontend/src/api/generated/public/models/apiChoicesRetrieveParams.ts b/frontend/src/api/generated/public/models/apiChoicesRetrieveParams.ts new file mode 100644 index 0000000..877c56f --- /dev/null +++ b/frontend/src/api/generated/public/models/apiChoicesRetrieveParams.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiChoicesRetrieveParams = { + /** + * JSON pole objektů {model: 'ModelName', field: 'field_name'} např. '[{"model": "User", "field": "role"}, {"model": "Carrier", "field": "shipping_method"}]' + */ + fields: string; + /** + * Jazyk pro labely (např. 'cz', 'en') + */ + lang?: string; +}; diff --git a/frontend/src/api/generated/public/models/apiDownloaderDownloadRetrieveParams.ts b/frontend/src/api/generated/public/models/apiDownloaderDownloadRetrieveParams.ts new file mode 100644 index 0000000..e018fd3 --- /dev/null +++ b/frontend/src/api/generated/public/models/apiDownloaderDownloadRetrieveParams.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export type ApiDownloaderDownloadRetrieveParams = { + /** + * Video URL to analyze + * @minLength 1 + */ + url: string; +}; diff --git a/frontend/src/api/generated/public/models/callback.ts b/frontend/src/api/generated/public/models/callback.ts new file mode 100644 index 0000000..bbb23e9 --- /dev/null +++ b/frontend/src/api/generated/public/models/callback.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Callback { + return_url: string; + notification_url?: string; +} diff --git a/frontend/src/api/generated/public/models/carrierRead.ts b/frontend/src/api/generated/public/models/carrierRead.ts new file mode 100644 index 0000000..bd4227f --- /dev/null +++ b/frontend/src/api/generated/public/models/carrierRead.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ShippingMethodEnum } from "./shippingMethodEnum"; +import type { StateFdaEnum } from "./stateFdaEnum"; +import type { ZasilkovnaPacketRead } from "./zasilkovnaPacketRead"; + +export interface CarrierRead { + readonly shipping_method: ShippingMethodEnum; + readonly state: StateFdaEnum; + readonly zasilkovna: readonly ZasilkovnaPacketRead[]; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly shipping_price: string; +} diff --git a/frontend/src/api/generated/public/models/category.ts b/frontend/src/api/generated/public/models/category.ts new file mode 100644 index 0000000..a397395 --- /dev/null +++ b/frontend/src/api/generated/public/models/category.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Category { + readonly id: number; + /** @maxLength 100 */ + name: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url: string; + /** @nullable */ + parent?: number | null; + description?: string; + image?: string; +} diff --git a/frontend/src/api/generated/public/models/contact.ts b/frontend/src/api/generated/public/models/contact.ts new file mode 100644 index 0000000..016c510 --- /dev/null +++ b/frontend/src/api/generated/public/models/contact.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Contact { + email: string; + first_name?: string; + last_name?: string; + phone_number?: string; + city?: string; + street?: string; + postal_code?: string; + country_code?: string; +} diff --git a/frontend/src/api/generated/public/models/contactMe.ts b/frontend/src/api/generated/public/models/contactMe.ts new file mode 100644 index 0000000..8379b01 --- /dev/null +++ b/frontend/src/api/generated/public/models/contactMe.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ContactMe { + readonly id: number; + /** @maxLength 254 */ + client_email: string; + content: string; + readonly sent_at: Date; +} diff --git a/frontend/src/api/generated/public/models/currencyEnum.ts b/frontend/src/api/generated/public/models/currencyEnum.ts new file mode 100644 index 0000000..d0abaf1 --- /dev/null +++ b/frontend/src/api/generated/public/models/currencyEnum.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `CZK` - cz#Czech Koruna + * `EUR` - cz#Euro + */ +export type CurrencyEnum = (typeof CurrencyEnum)[keyof typeof CurrencyEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const CurrencyEnum = { + CZK: "CZK", + EUR: "EUR", +} as const; diff --git a/frontend/src/api/generated/public/models/customTokenObtainPair.ts b/frontend/src/api/generated/public/models/customTokenObtainPair.ts new file mode 100644 index 0000000..95a29ed --- /dev/null +++ b/frontend/src/api/generated/public/models/customTokenObtainPair.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface CustomTokenObtainPair { + username: string; + password: string; +} diff --git a/frontend/src/api/generated/public/models/customUser.ts b/frontend/src/api/generated/public/models/customUser.ts new file mode 100644 index 0000000..f48e6a2 --- /dev/null +++ b/frontend/src/api/generated/public/models/customUser.ts @@ -0,0 +1,45 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { RoleEnum } from "./roleEnum"; + +export interface CustomUser { + readonly id: number; + /** Požadováno. 150 znaků nebo méně. Pouze písmena, číslice a znaky @/./+/-/_. */ + readonly username: string; + /** @maxLength 150 */ + first_name?: string; + /** @maxLength 150 */ + last_name?: string; + /** @maxLength 254 */ + email: string; + role?: RoleEnum; + email_verified?: boolean; + /** + * @maxLength 16 + * @nullable + * @pattern ^\+?\d{9,15}$ + */ + phone_number?: string | null; + readonly create_time: Date; + /** + * @maxLength 100 + * @nullable + */ + city?: string | null; + /** + * @maxLength 200 + * @nullable + */ + street?: string | null; + /** + * @maxLength 5 + * @nullable + * @pattern ^\d{5}$ + */ + postal_code?: string | null; + readonly gdpr: boolean; + is_active?: boolean; +} diff --git a/frontend/src/api/generated/public/models/discountCode.ts b/frontend/src/api/generated/public/models/discountCode.ts new file mode 100644 index 0000000..298445a --- /dev/null +++ b/frontend/src/api/generated/public/models/discountCode.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface DiscountCode { + readonly id: number; + /** @maxLength 50 */ + code: string; + /** @maxLength 255 */ + description?: string; + /** + * Procento sleva 0-100 + * @minimum 0 + * @maximum 100 + * @nullable + */ + percent?: number | null; + /** + * Fixní sleva v CZK + * @nullable + * @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ + */ + amount?: string | null; + valid_from?: Date; + /** @nullable */ + valid_to?: Date | null; + active?: boolean; + /** + * @minimum 0 + * @maximum 9223372036854776000 + * @nullable + */ + usage_limit?: number | null; + readonly used_count: number; + specific_products?: number[]; + specific_categories?: number[]; +} diff --git a/frontend/src/api/generated/public/models/downloadErrorResponse.ts b/frontend/src/api/generated/public/models/downloadErrorResponse.ts new file mode 100644 index 0000000..036a310 --- /dev/null +++ b/frontend/src/api/generated/public/models/downloadErrorResponse.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface DownloadErrorResponse { + error: string; + allowed?: string[]; +} diff --git a/frontend/src/api/generated/public/models/downloadRequest.ts b/frontend/src/api/generated/public/models/downloadRequest.ts new file mode 100644 index 0000000..0193507 --- /dev/null +++ b/frontend/src/api/generated/public/models/downloadRequest.ts @@ -0,0 +1,36 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ExtEnum } from "./extEnum"; +import type { FormatEnum } from "./formatEnum"; + +export interface DownloadRequest { + /** Video URL to download */ + url: string; + /** Choose container format: mp4 (H.264 + AAC, most compatible), mkv (flexible, lossless container), webm (VP9/AV1 + Opus), flv (legacy), mov (Apple-friendly), avi (older), ogg (mostly obsolete). + +* `mp4` - mp4 +* `mkv` - mkv +* `webm` - webm +* `flv` - flv +* `mov` - mov +* `avi` - avi +* `ogg` - ogg */ + ext?: ExtEnum; + /** Alias of 'ext' (deprecated). + +* `mp4` - mp4 +* `mkv` - mkv +* `webm` - webm +* `flv` - flv +* `mov` - mov +* `avi` - avi +* `ogg` - ogg */ + format?: FormatEnum; + /** Target max video height (e.g. 1080). */ + video_quality: number; + /** Target max audio bitrate in kbps (e.g. 160). */ + audio_quality: number; +} diff --git a/frontend/src/api/generated/public/models/downloaderStats.ts b/frontend/src/api/generated/public/models/downloaderStats.ts new file mode 100644 index 0000000..28a7e0c --- /dev/null +++ b/frontend/src/api/generated/public/models/downloaderStats.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface DownloaderStats { + total_downloads: number; + /** @nullable */ + avg_length_of_media: number | null; + /** @nullable */ + avg_file_size: number | null; + /** @nullable */ + total_length_of_media: number | null; + /** @nullable */ + total_file_size: number | null; + /** @nullable */ + most_common_format: string | null; +} diff --git a/frontend/src/api/generated/public/models/errorResponse.ts b/frontend/src/api/generated/public/models/errorResponse.ts new file mode 100644 index 0000000..fc2b666 --- /dev/null +++ b/frontend/src/api/generated/public/models/errorResponse.ts @@ -0,0 +1,9 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ErrorResponse { + error: string; +} diff --git a/frontend/src/api/generated/public/models/extEnum.ts b/frontend/src/api/generated/public/models/extEnum.ts new file mode 100644 index 0000000..f4ed4f6 --- /dev/null +++ b/frontend/src/api/generated/public/models/extEnum.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `mp4` - mp4 + * `mkv` - mkv + * `webm` - webm + * `flv` - flv + * `mov` - mov + * `avi` - avi + * `ogg` - ogg + */ +export type ExtEnum = (typeof ExtEnum)[keyof typeof ExtEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ExtEnum = { + mp4: "mp4", + mkv: "mkv", + webm: "webm", + flv: "flv", + mov: "mov", + avi: "avi", + ogg: "ogg", +} as const; diff --git a/frontend/src/api/generated/public/models/formatEnum.ts b/frontend/src/api/generated/public/models/formatEnum.ts new file mode 100644 index 0000000..aefaf77 --- /dev/null +++ b/frontend/src/api/generated/public/models/formatEnum.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `mp4` - mp4 + * `mkv` - mkv + * `webm` - webm + * `flv` - flv + * `mov` - mov + * `avi` - avi + * `ogg` - ogg + */ +export type FormatEnum = (typeof FormatEnum)[keyof typeof FormatEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const FormatEnum = { + mp4: "mp4", + mkv: "mkv", + webm: "webm", + flv: "flv", + mov: "mov", + avi: "avi", + ogg: "ogg", +} as const; diff --git a/frontend/src/api/generated/public/models/index.ts b/frontend/src/api/generated/public/models/index.ts new file mode 100644 index 0000000..c270709 --- /dev/null +++ b/frontend/src/api/generated/public/models/index.ts @@ -0,0 +1,84 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export * from "./additionalParam"; +export * from "./apiChoicesRetrieve200"; +export * from "./apiChoicesRetrieve200Item"; +export * from "./apiChoicesRetrieveParams"; +export * from "./apiDownloaderDownloadRetrieveParams"; +export * from "./callback"; +export * from "./carrierRead"; +export * from "./category"; +export * from "./contact"; +export * from "./contactMe"; +export * from "./currencyEnum"; +export * from "./customTokenObtainPair"; +export * from "./customUser"; +export * from "./discountCode"; +export * from "./downloadErrorResponse"; +export * from "./downloadRequest"; +export * from "./downloaderStats"; +export * from "./errorResponse"; +export * from "./extEnum"; +export * from "./formatEnum"; +export * from "./item"; +export * from "./orderCarrier"; +export * from "./orderCreate"; +export * from "./orderItemCreate"; +export * from "./orderItemRead"; +export * from "./orderMini"; +export * from "./orderRead"; +export * from "./paginatedCategoryList"; +export * from "./paginatedContactMeList"; +export * from "./paginatedCustomUserList"; +export * from "./paginatedDiscountCodeList"; +export * from "./paginatedOrderReadList"; +export * from "./paginatedProductImageList"; +export * from "./paginatedProductList"; +export * from "./paginatedRefundList"; +export * from "./paginatedSiteConfigurationAdminList"; +export * from "./paginatedSiteConfigurationPublicList"; +export * from "./paginatedZasilkovnaShipmentList"; +export * from "./passwordResetConfirm"; +export * from "./passwordResetRequest"; +export * from "./patchedCategory"; +export * from "./patchedContactMe"; +export * from "./patchedCustomUser"; +export * from "./patchedDiscountCode"; +export * from "./patchedOrderRead"; +export * from "./patchedProduct"; +export * from "./patchedProductImage"; +export * from "./patchedRefund"; +export * from "./patchedSiteConfigurationAdmin"; +export * from "./patchedSiteConfigurationAdminOpeningHours"; +export * from "./payer"; +export * from "./payment"; +export * from "./paymentBody"; +export * from "./paymentCreate"; +export * from "./paymentMethodEnum"; +export * from "./paymentRead"; +export * from "./product"; +export * from "./productImage"; +export * from "./productMini"; +export * from "./reasonChoiceEnum"; +export * from "./refund"; +export * from "./roleEnum"; +export * from "./shippingMethodEnum"; +export * from "./siteConfigurationAdmin"; +export * from "./siteConfigurationAdminOpeningHours"; +export * from "./siteConfigurationPublic"; +export * from "./siteConfigurationPublicOpeningHours"; +export * from "./stateE15Enum"; +export * from "./stateFdaEnum"; +export * from "./statusEnum"; +export * from "./trackingURL"; +export * from "./userRegistration"; +export * from "./videoInfoResponse"; +export * from "./zasilkovnaPacket"; +export * from "./zasilkovnaPacketRead"; +export * from "./zasilkovnaPacketReadReturnRouting"; +export * from "./zasilkovnaPacketReturnRouting"; +export * from "./zasilkovnaShipment"; diff --git a/frontend/src/api/generated/public/models/item.ts b/frontend/src/api/generated/public/models/item.ts new file mode 100644 index 0000000..c7a7c1e --- /dev/null +++ b/frontend/src/api/generated/public/models/item.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Item { + name: string; + /** + * Minor units + * @minimum 1 + */ + amount: number; + type?: string; + /** @minimum 1 */ + count?: number; +} diff --git a/frontend/src/api/generated/public/models/orderCarrier.ts b/frontend/src/api/generated/public/models/orderCarrier.ts new file mode 100644 index 0000000..2ae43b4 --- /dev/null +++ b/frontend/src/api/generated/public/models/orderCarrier.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ShippingMethodEnum } from "./shippingMethodEnum"; +import type { StateFdaEnum } from "./stateFdaEnum"; +import type { ZasilkovnaPacket } from "./zasilkovnaPacket"; + +export interface OrderCarrier { + shipping_method?: ShippingMethodEnum; + readonly state: StateFdaEnum; + readonly zasilkovna: readonly ZasilkovnaPacket[]; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly shipping_price: string; + packeta_address_id?: number; +} diff --git a/frontend/src/api/generated/public/models/orderCreate.ts b/frontend/src/api/generated/public/models/orderCreate.ts new file mode 100644 index 0000000..acd9220 --- /dev/null +++ b/frontend/src/api/generated/public/models/orderCreate.ts @@ -0,0 +1,24 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { OrderItemCreate } from "./orderItemCreate"; +import type { OrderCarrier } from "./orderCarrier"; +import type { Payment } from "./payment"; + +export interface OrderCreate { + first_name?: string; + last_name?: string; + email?: string; + phone?: string; + address?: string; + city?: string; + postal_code?: string; + country?: string; + note?: string; + items: OrderItemCreate[]; + carrier: OrderCarrier; + payment: Payment; + discount_codes?: string[]; +} diff --git a/frontend/src/api/generated/public/models/orderItemCreate.ts b/frontend/src/api/generated/public/models/orderItemCreate.ts new file mode 100644 index 0000000..5618bd6 --- /dev/null +++ b/frontend/src/api/generated/public/models/orderItemCreate.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface OrderItemCreate { + product_id: number; + /** @minimum 1 */ + quantity?: number; +} diff --git a/frontend/src/api/generated/public/models/orderItemRead.ts b/frontend/src/api/generated/public/models/orderItemRead.ts new file mode 100644 index 0000000..ac483dc --- /dev/null +++ b/frontend/src/api/generated/public/models/orderItemRead.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ProductMini } from "./productMini"; + +export interface OrderItemRead { + readonly id: number; + readonly product: ProductMini; + readonly quantity: number; +} diff --git a/frontend/src/api/generated/public/models/orderMini.ts b/frontend/src/api/generated/public/models/orderMini.ts new file mode 100644 index 0000000..b1f8b74 --- /dev/null +++ b/frontend/src/api/generated/public/models/orderMini.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StatusEnum } from "./statusEnum"; + +export interface OrderMini { + readonly id: number; + readonly status: StatusEnum; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly total_price: string; + readonly created_at: Date; +} diff --git a/frontend/src/api/generated/public/models/orderRead.ts b/frontend/src/api/generated/public/models/orderRead.ts new file mode 100644 index 0000000..4c6f2fa --- /dev/null +++ b/frontend/src/api/generated/public/models/orderRead.ts @@ -0,0 +1,34 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StatusEnum } from "./statusEnum"; +import type { OrderItemRead } from "./orderItemRead"; +import type { CarrierRead } from "./carrierRead"; +import type { PaymentRead } from "./paymentRead"; + +export interface OrderRead { + readonly id: number; + readonly status: StatusEnum; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly total_price: string; + readonly currency: string; + /** @nullable */ + readonly user: number | null; + readonly first_name: string; + readonly last_name: string; + readonly email: string; + readonly phone: string; + readonly address: string; + readonly city: string; + readonly postal_code: string; + readonly country: string; + readonly note: string; + readonly created_at: Date; + readonly updated_at: Date; + readonly items: readonly OrderItemRead[]; + readonly carrier: CarrierRead; + readonly payment: PaymentRead; + readonly discount_codes: string; +} diff --git a/frontend/src/api/generated/public/models/paginatedCategoryList.ts b/frontend/src/api/generated/public/models/paginatedCategoryList.ts new file mode 100644 index 0000000..2f1b588 --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedCategoryList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Category } from "./category"; + +export interface PaginatedCategoryList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: Category[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedContactMeList.ts b/frontend/src/api/generated/public/models/paginatedContactMeList.ts new file mode 100644 index 0000000..a21a2c2 --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedContactMeList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ContactMe } from "./contactMe"; + +export interface PaginatedContactMeList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: ContactMe[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedCustomUserList.ts b/frontend/src/api/generated/public/models/paginatedCustomUserList.ts new file mode 100644 index 0000000..a48846d --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedCustomUserList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { CustomUser } from "./customUser"; + +export interface PaginatedCustomUserList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: CustomUser[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedDiscountCodeList.ts b/frontend/src/api/generated/public/models/paginatedDiscountCodeList.ts new file mode 100644 index 0000000..99ae666 --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedDiscountCodeList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { DiscountCode } from "./discountCode"; + +export interface PaginatedDiscountCodeList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: DiscountCode[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedOrderReadList.ts b/frontend/src/api/generated/public/models/paginatedOrderReadList.ts new file mode 100644 index 0000000..0a71522 --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedOrderReadList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { OrderRead } from "./orderRead"; + +export interface PaginatedOrderReadList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: OrderRead[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedProductImageList.ts b/frontend/src/api/generated/public/models/paginatedProductImageList.ts new file mode 100644 index 0000000..9074e50 --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedProductImageList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ProductImage } from "./productImage"; + +export interface PaginatedProductImageList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: ProductImage[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedProductList.ts b/frontend/src/api/generated/public/models/paginatedProductList.ts new file mode 100644 index 0000000..86ec08a --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedProductList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Product } from "./product"; + +export interface PaginatedProductList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: Product[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedRefundList.ts b/frontend/src/api/generated/public/models/paginatedRefundList.ts new file mode 100644 index 0000000..b76cf5e --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedRefundList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Refund } from "./refund"; + +export interface PaginatedRefundList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: Refund[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedSiteConfigurationAdminList.ts b/frontend/src/api/generated/public/models/paginatedSiteConfigurationAdminList.ts new file mode 100644 index 0000000..22334d9 --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedSiteConfigurationAdminList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationAdmin } from "./siteConfigurationAdmin"; + +export interface PaginatedSiteConfigurationAdminList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: SiteConfigurationAdmin[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedSiteConfigurationPublicList.ts b/frontend/src/api/generated/public/models/paginatedSiteConfigurationPublicList.ts new file mode 100644 index 0000000..1f221bb --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedSiteConfigurationPublicList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationPublic } from "./siteConfigurationPublic"; + +export interface PaginatedSiteConfigurationPublicList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: SiteConfigurationPublic[]; +} diff --git a/frontend/src/api/generated/public/models/paginatedZasilkovnaShipmentList.ts b/frontend/src/api/generated/public/models/paginatedZasilkovnaShipmentList.ts new file mode 100644 index 0000000..d7dc36a --- /dev/null +++ b/frontend/src/api/generated/public/models/paginatedZasilkovnaShipmentList.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ZasilkovnaShipment } from "./zasilkovnaShipment"; + +export interface PaginatedZasilkovnaShipmentList { + count: number; + /** @nullable */ + next?: string | null; + /** @nullable */ + previous?: string | null; + results: ZasilkovnaShipment[]; +} diff --git a/frontend/src/api/generated/public/models/passwordResetConfirm.ts b/frontend/src/api/generated/public/models/passwordResetConfirm.ts new file mode 100644 index 0000000..05b6555 --- /dev/null +++ b/frontend/src/api/generated/public/models/passwordResetConfirm.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PasswordResetConfirm { + /** Nové heslo musí mít alespoň 8 znaků, obsahovat velká a malá písmena a číslici. */ + password: string; +} diff --git a/frontend/src/api/generated/public/models/passwordResetRequest.ts b/frontend/src/api/generated/public/models/passwordResetRequest.ts new file mode 100644 index 0000000..5a0bd8d --- /dev/null +++ b/frontend/src/api/generated/public/models/passwordResetRequest.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PasswordResetRequest { + /** E-mail registrovaného a aktivního uživatele, na který bude zaslán reset hesla. */ + email: string; +} diff --git a/frontend/src/api/generated/public/models/patchedCategory.ts b/frontend/src/api/generated/public/models/patchedCategory.ts new file mode 100644 index 0000000..419d2dd --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedCategory.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedCategory { + readonly id?: number; + /** @maxLength 100 */ + name?: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url?: string; + /** @nullable */ + parent?: number | null; + description?: string; + image?: string; +} diff --git a/frontend/src/api/generated/public/models/patchedContactMe.ts b/frontend/src/api/generated/public/models/patchedContactMe.ts new file mode 100644 index 0000000..c3201fd --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedContactMe.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedContactMe { + readonly id?: number; + /** @maxLength 254 */ + client_email?: string; + content?: string; + readonly sent_at?: Date; +} diff --git a/frontend/src/api/generated/public/models/patchedCustomUser.ts b/frontend/src/api/generated/public/models/patchedCustomUser.ts new file mode 100644 index 0000000..3078778 --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedCustomUser.ts @@ -0,0 +1,45 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { RoleEnum } from "./roleEnum"; + +export interface PatchedCustomUser { + readonly id?: number; + /** Požadováno. 150 znaků nebo méně. Pouze písmena, číslice a znaky @/./+/-/_. */ + readonly username?: string; + /** @maxLength 150 */ + first_name?: string; + /** @maxLength 150 */ + last_name?: string; + /** @maxLength 254 */ + email?: string; + role?: RoleEnum; + email_verified?: boolean; + /** + * @maxLength 16 + * @nullable + * @pattern ^\+?\d{9,15}$ + */ + phone_number?: string | null; + readonly create_time?: Date; + /** + * @maxLength 100 + * @nullable + */ + city?: string | null; + /** + * @maxLength 200 + * @nullable + */ + street?: string | null; + /** + * @maxLength 5 + * @nullable + * @pattern ^\d{5}$ + */ + postal_code?: string | null; + readonly gdpr?: boolean; + is_active?: boolean; +} diff --git a/frontend/src/api/generated/public/models/patchedDiscountCode.ts b/frontend/src/api/generated/public/models/patchedDiscountCode.ts new file mode 100644 index 0000000..81092bb --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedDiscountCode.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedDiscountCode { + readonly id?: number; + /** @maxLength 50 */ + code?: string; + /** @maxLength 255 */ + description?: string; + /** + * Procento sleva 0-100 + * @minimum 0 + * @maximum 100 + * @nullable + */ + percent?: number | null; + /** + * Fixní sleva v CZK + * @nullable + * @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ + */ + amount?: string | null; + valid_from?: Date; + /** @nullable */ + valid_to?: Date | null; + active?: boolean; + /** + * @minimum 0 + * @maximum 9223372036854776000 + * @nullable + */ + usage_limit?: number | null; + readonly used_count?: number; + specific_products?: number[]; + specific_categories?: number[]; +} diff --git a/frontend/src/api/generated/public/models/patchedOrderRead.ts b/frontend/src/api/generated/public/models/patchedOrderRead.ts new file mode 100644 index 0000000..5b722aa --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedOrderRead.ts @@ -0,0 +1,34 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StatusEnum } from "./statusEnum"; +import type { OrderItemRead } from "./orderItemRead"; +import type { CarrierRead } from "./carrierRead"; +import type { PaymentRead } from "./paymentRead"; + +export interface PatchedOrderRead { + readonly id?: number; + readonly status?: StatusEnum; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + readonly total_price?: string; + readonly currency?: string; + /** @nullable */ + readonly user?: number | null; + readonly first_name?: string; + readonly last_name?: string; + readonly email?: string; + readonly phone?: string; + readonly address?: string; + readonly city?: string; + readonly postal_code?: string; + readonly country?: string; + readonly note?: string; + readonly created_at?: Date; + readonly updated_at?: Date; + readonly items?: readonly OrderItemRead[]; + readonly carrier?: CarrierRead; + readonly payment?: PaymentRead; + readonly discount_codes?: string; +} diff --git a/frontend/src/api/generated/public/models/patchedProduct.ts b/frontend/src/api/generated/public/models/patchedProduct.ts new file mode 100644 index 0000000..0365abd --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedProduct.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedProduct { + readonly id?: number; + /** @maxLength 200 */ + name?: string; + description?: string; + /** + * @maxLength 100 + * @nullable + */ + code?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + price?: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url?: string; + /** + * @minimum 0 + * @maximum 9223372036854776000 + */ + stock?: number; + is_active?: boolean; + /** @nullable */ + limited_to?: Date | null; + readonly created_at?: Date; + readonly updated_at?: Date; + category?: number; + /** @nullable */ + default_carrier?: number | null; + /** Symetrické varianty produktu: pokud přidáte variantu A → B, Django automaticky přidá i variantu B → A. Všechny varianty jsou rovnocenné a zobrazí se vzájemně. */ + variants?: number[]; +} diff --git a/frontend/src/api/generated/public/models/patchedProductImage.ts b/frontend/src/api/generated/public/models/patchedProductImage.ts new file mode 100644 index 0000000..276f2e0 --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedProductImage.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface PatchedProductImage { + readonly id?: number; + product?: number; + image?: string; + /** @maxLength 150 */ + alt_text?: string; + is_main?: boolean; +} diff --git a/frontend/src/api/generated/public/models/patchedRefund.ts b/frontend/src/api/generated/public/models/patchedRefund.ts new file mode 100644 index 0000000..bf8cfbc --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedRefund.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ReasonChoiceEnum } from "./reasonChoiceEnum"; + +export interface PatchedRefund { + readonly id?: number; + reason_choice?: ReasonChoiceEnum; + reason_text?: string; + readonly verified?: boolean; + readonly created_at?: Date; + order?: number; +} diff --git a/frontend/src/api/generated/public/models/patchedSiteConfigurationAdmin.ts b/frontend/src/api/generated/public/models/patchedSiteConfigurationAdmin.ts new file mode 100644 index 0000000..7967712 --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedSiteConfigurationAdmin.ts @@ -0,0 +1,77 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PatchedSiteConfigurationAdminOpeningHours } from "./patchedSiteConfigurationAdminOpeningHours"; +import type { CurrencyEnum } from "./currencyEnum"; + +export interface PatchedSiteConfigurationAdmin { + readonly id?: number; + /** @maxLength 100 */ + name?: string; + /** @nullable */ + logo?: string | null; + /** @nullable */ + favicon?: string | null; + /** + * @maxLength 254 + * @nullable + */ + contact_email?: string | null; + /** + * @maxLength 20 + * @nullable + */ + contact_phone?: string | null; + /** @nullable */ + contact_address?: string | null; + /** @nullable */ + opening_hours?: PatchedSiteConfigurationAdminOpeningHours; + /** + * @maxLength 200 + * @nullable + */ + facebook_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + instagram_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + youtube_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + tiktok_url?: string | null; + /** + * @maxLength 20 + * @nullable + */ + whatsapp_number?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + zasilkovna_shipping_price?: string; + /** + * API klíč pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_key?: string | null; + /** + * API heslo pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_password?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + free_shipping_over?: string; + /** Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + multiplying_coupons?: boolean; + /** Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + addition_of_coupons_amount?: boolean; + currency?: CurrencyEnum; +} diff --git a/frontend/src/api/generated/public/models/patchedSiteConfigurationAdminOpeningHours.ts b/frontend/src/api/generated/public/models/patchedSiteConfigurationAdminOpeningHours.ts new file mode 100644 index 0000000..0e4a062 --- /dev/null +++ b/frontend/src/api/generated/public/models/patchedSiteConfigurationAdminOpeningHours.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * @nullable + */ +export type PatchedSiteConfigurationAdminOpeningHours = unknown | null; diff --git a/frontend/src/api/generated/public/models/payer.ts b/frontend/src/api/generated/public/models/payer.ts new file mode 100644 index 0000000..e90d28f --- /dev/null +++ b/frontend/src/api/generated/public/models/payer.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Contact } from "./contact"; + +export interface Payer { + contact: Contact; + allowed_payment_instruments?: string[]; + default_payment_instrument?: string; + allowed_swifts?: string[]; + default_swift?: string; +} diff --git a/frontend/src/api/generated/public/models/payment.ts b/frontend/src/api/generated/public/models/payment.ts new file mode 100644 index 0000000..6b383e7 --- /dev/null +++ b/frontend/src/api/generated/public/models/payment.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PaymentMethodEnum } from "./paymentMethodEnum"; + +export interface Payment { + readonly id: number; + payment_method?: PaymentMethodEnum; + /** @nullable */ + readonly stripe: number | null; + readonly stripe_session_id: string; + readonly stripe_payment_intent: string; + readonly stripe_session_url: string; +} diff --git a/frontend/src/api/generated/public/models/paymentBody.ts b/frontend/src/api/generated/public/models/paymentBody.ts new file mode 100644 index 0000000..69e05bd --- /dev/null +++ b/frontend/src/api/generated/public/models/paymentBody.ts @@ -0,0 +1,26 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { Payer } from "./payer"; +import type { Callback } from "./callback"; +import type { Item } from "./item"; +import type { AdditionalParam } from "./additionalParam"; + +export interface PaymentBody { + /** + * Minor units (e.g. 100 CZK = 10000) + * @minimum 1 + */ + amount: number; + currency: string; + order_number: string; + order_description?: string; + payer: Payer; + callback: Callback; + items?: Item[]; + additional_params?: AdditionalParam[]; + lang?: string; + preauthorize?: boolean; +} diff --git a/frontend/src/api/generated/public/models/paymentCreate.ts b/frontend/src/api/generated/public/models/paymentCreate.ts new file mode 100644 index 0000000..2bc6115 --- /dev/null +++ b/frontend/src/api/generated/public/models/paymentCreate.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PaymentBody } from "./paymentBody"; + +export interface PaymentCreate { + payment: PaymentBody; + user_id?: number; +} diff --git a/frontend/src/api/generated/public/models/paymentMethodEnum.ts b/frontend/src/api/generated/public/models/paymentMethodEnum.ts new file mode 100644 index 0000000..dae3eda --- /dev/null +++ b/frontend/src/api/generated/public/models/paymentMethodEnum.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `Site` - cz#Platba v obchodě + * `stripe` - cz#Bankovní převod + * `cash_on_delivery` - cz#Dobírka + */ +export type PaymentMethodEnum = + (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const PaymentMethodEnum = { + Site: "Site", + stripe: "stripe", + cash_on_delivery: "cash_on_delivery", +} as const; diff --git a/frontend/src/api/generated/public/models/paymentRead.ts b/frontend/src/api/generated/public/models/paymentRead.ts new file mode 100644 index 0000000..174cbb3 --- /dev/null +++ b/frontend/src/api/generated/public/models/paymentRead.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { PaymentMethodEnum } from "./paymentMethodEnum"; + +export interface PaymentRead { + readonly payment_method: PaymentMethodEnum; +} diff --git a/frontend/src/api/generated/public/models/product.ts b/frontend/src/api/generated/public/models/product.ts new file mode 100644 index 0000000..6146b27 --- /dev/null +++ b/frontend/src/api/generated/public/models/product.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface Product { + readonly id: number; + /** @maxLength 200 */ + name: string; + description?: string; + /** + * @maxLength 100 + * @nullable + */ + code?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + price: string; + /** + * @maxLength 50 + * @pattern ^[-a-zA-Z0-9_]+$ + */ + url: string; + /** + * @minimum 0 + * @maximum 9223372036854776000 + */ + stock?: number; + is_active?: boolean; + /** @nullable */ + limited_to?: Date | null; + readonly created_at: Date; + readonly updated_at: Date; + category: number; + /** @nullable */ + default_carrier?: number | null; + /** Symetrické varianty produktu: pokud přidáte variantu A → B, Django automaticky přidá i variantu B → A. Všechny varianty jsou rovnocenné a zobrazí se vzájemně. */ + variants?: number[]; +} diff --git a/frontend/src/api/generated/public/models/productImage.ts b/frontend/src/api/generated/public/models/productImage.ts new file mode 100644 index 0000000..a192a08 --- /dev/null +++ b/frontend/src/api/generated/public/models/productImage.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ProductImage { + readonly id: number; + product: number; + image: string; + /** @maxLength 150 */ + alt_text?: string; + is_main?: boolean; +} diff --git a/frontend/src/api/generated/public/models/productMini.ts b/frontend/src/api/generated/public/models/productMini.ts new file mode 100644 index 0000000..ce227a0 --- /dev/null +++ b/frontend/src/api/generated/public/models/productMini.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ProductMini { + readonly id: number; + /** @maxLength 200 */ + name: string; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + price: string; +} diff --git a/frontend/src/api/generated/public/models/reasonChoiceEnum.ts b/frontend/src/api/generated/public/models/reasonChoiceEnum.ts new file mode 100644 index 0000000..f7311f2 --- /dev/null +++ b/frontend/src/api/generated/public/models/reasonChoiceEnum.ts @@ -0,0 +1,22 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `retuning_before_fourteen_day_period` - cz#Vrácení před uplynutím 14-ti denní lhůty + * `damaged_product` - cz#Poškozený produkt + * `wrong_item` - cz#Špatná položka + * `other` - cz#Jiný důvod + */ +export type ReasonChoiceEnum = + (typeof ReasonChoiceEnum)[keyof typeof ReasonChoiceEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ReasonChoiceEnum = { + retuning_before_fourteen_day_period: "retuning_before_fourteen_day_period", + damaged_product: "damaged_product", + wrong_item: "wrong_item", + other: "other", +} as const; diff --git a/frontend/src/api/generated/public/models/refund.ts b/frontend/src/api/generated/public/models/refund.ts new file mode 100644 index 0000000..0b154d8 --- /dev/null +++ b/frontend/src/api/generated/public/models/refund.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { ReasonChoiceEnum } from "./reasonChoiceEnum"; + +export interface Refund { + readonly id: number; + reason_choice: ReasonChoiceEnum; + reason_text?: string; + readonly verified: boolean; + readonly created_at: Date; + order: number; +} diff --git a/frontend/src/api/generated/public/models/roleEnum.ts b/frontend/src/api/generated/public/models/roleEnum.ts new file mode 100644 index 0000000..18f15f4 --- /dev/null +++ b/frontend/src/api/generated/public/models/roleEnum.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `admin` - cz#Administrátor + * `mod` - cz#Moderator + * `regular` - cz#Regular + */ +export type RoleEnum = (typeof RoleEnum)[keyof typeof RoleEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const RoleEnum = { + admin: "admin", + mod: "mod", + regular: "regular", +} as const; diff --git a/frontend/src/api/generated/public/models/shippingMethodEnum.ts b/frontend/src/api/generated/public/models/shippingMethodEnum.ts new file mode 100644 index 0000000..50ed123 --- /dev/null +++ b/frontend/src/api/generated/public/models/shippingMethodEnum.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `packeta` - cz#Zásilkovna + * `store` - cz#Osobní odběr + */ +export type ShippingMethodEnum = + (typeof ShippingMethodEnum)[keyof typeof ShippingMethodEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ShippingMethodEnum = { + packeta: "packeta", + store: "store", +} as const; diff --git a/frontend/src/api/generated/public/models/siteConfigurationAdmin.ts b/frontend/src/api/generated/public/models/siteConfigurationAdmin.ts new file mode 100644 index 0000000..0a029ea --- /dev/null +++ b/frontend/src/api/generated/public/models/siteConfigurationAdmin.ts @@ -0,0 +1,77 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationAdminOpeningHours } from "./siteConfigurationAdminOpeningHours"; +import type { CurrencyEnum } from "./currencyEnum"; + +export interface SiteConfigurationAdmin { + readonly id: number; + /** @maxLength 100 */ + name?: string; + /** @nullable */ + logo?: string | null; + /** @nullable */ + favicon?: string | null; + /** + * @maxLength 254 + * @nullable + */ + contact_email?: string | null; + /** + * @maxLength 20 + * @nullable + */ + contact_phone?: string | null; + /** @nullable */ + contact_address?: string | null; + /** @nullable */ + opening_hours?: SiteConfigurationAdminOpeningHours; + /** + * @maxLength 200 + * @nullable + */ + facebook_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + instagram_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + youtube_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + tiktok_url?: string | null; + /** + * @maxLength 20 + * @nullable + */ + whatsapp_number?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + zasilkovna_shipping_price?: string; + /** + * API klíč pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_key?: string | null; + /** + * API heslo pro přístup k Zásilkovna API (zatím není využito) + * @maxLength 255 + * @nullable + */ + zasilkovna_api_password?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + free_shipping_over?: string; + /** Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + multiplying_coupons?: boolean; + /** Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón */ + addition_of_coupons_amount?: boolean; + currency?: CurrencyEnum; +} diff --git a/frontend/src/api/generated/public/models/siteConfigurationAdminOpeningHours.ts b/frontend/src/api/generated/public/models/siteConfigurationAdminOpeningHours.ts new file mode 100644 index 0000000..e79fcad --- /dev/null +++ b/frontend/src/api/generated/public/models/siteConfigurationAdminOpeningHours.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * @nullable + */ +export type SiteConfigurationAdminOpeningHours = unknown | null; diff --git a/frontend/src/api/generated/public/models/siteConfigurationPublic.ts b/frontend/src/api/generated/public/models/siteConfigurationPublic.ts new file mode 100644 index 0000000..0887202 --- /dev/null +++ b/frontend/src/api/generated/public/models/siteConfigurationPublic.ts @@ -0,0 +1,56 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { SiteConfigurationPublicOpeningHours } from "./siteConfigurationPublicOpeningHours"; +import type { CurrencyEnum } from "./currencyEnum"; + +export interface SiteConfigurationPublic { + readonly id: number; + /** @maxLength 100 */ + name?: string; + /** @nullable */ + logo?: string | null; + /** @nullable */ + favicon?: string | null; + /** + * @maxLength 254 + * @nullable + */ + contact_email?: string | null; + /** + * @maxLength 20 + * @nullable + */ + contact_phone?: string | null; + /** @nullable */ + contact_address?: string | null; + /** @nullable */ + opening_hours?: SiteConfigurationPublicOpeningHours; + /** + * @maxLength 200 + * @nullable + */ + facebook_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + instagram_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + youtube_url?: string | null; + /** + * @maxLength 200 + * @nullable + */ + tiktok_url?: string | null; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + zasilkovna_shipping_price?: string; + /** @pattern ^-?\d{0,8}(?:\.\d{0,2})?$ */ + free_shipping_over?: string; + currency?: CurrencyEnum; +} diff --git a/frontend/src/api/generated/public/models/siteConfigurationPublicOpeningHours.ts b/frontend/src/api/generated/public/models/siteConfigurationPublicOpeningHours.ts new file mode 100644 index 0000000..300d3d4 --- /dev/null +++ b/frontend/src/api/generated/public/models/siteConfigurationPublicOpeningHours.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * @nullable + */ +export type SiteConfigurationPublicOpeningHours = unknown | null; diff --git a/frontend/src/api/generated/public/models/stateE15Enum.ts b/frontend/src/api/generated/public/models/stateE15Enum.ts new file mode 100644 index 0000000..e2ca3c9 --- /dev/null +++ b/frontend/src/api/generated/public/models/stateE15Enum.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `WAITING_FOR_ORDERING_SHIPMENT` - cz#Čeká na objednání zásilkovny + * `PENDING` - cz#Podáno + * `SENDED` - cz#Odesláno + * `ARRIVED` - cz#Doručeno + * `CANCELED` - cz#Zrušeno + * `RETURNING` - cz#Posláno zpátky + * `RETURNED` - cz#Vráceno + */ +export type StateE15Enum = (typeof StateE15Enum)[keyof typeof StateE15Enum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const StateE15Enum = { + WAITING_FOR_ORDERING_SHIPMENT: "WAITING_FOR_ORDERING_SHIPMENT", + PENDING: "PENDING", + SENDED: "SENDED", + ARRIVED: "ARRIVED", + CANCELED: "CANCELED", + RETURNING: "RETURNING", + RETURNED: "RETURNED", +} as const; diff --git a/frontend/src/api/generated/public/models/stateFdaEnum.ts b/frontend/src/api/generated/public/models/stateFdaEnum.ts new file mode 100644 index 0000000..d76f293 --- /dev/null +++ b/frontend/src/api/generated/public/models/stateFdaEnum.ts @@ -0,0 +1,21 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `ordered` - cz#Objednávka se připravuje + * `shipped` - cz#Odesláno + * `delivered` - cz#Doručeno + * `ready_to_pickup` - cz#Připraveno k vyzvednutí + */ +export type StateFdaEnum = (typeof StateFdaEnum)[keyof typeof StateFdaEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const StateFdaEnum = { + ordered: "ordered", + shipped: "shipped", + delivered: "delivered", + ready_to_pickup: "ready_to_pickup", +} as const; diff --git a/frontend/src/api/generated/public/models/statusEnum.ts b/frontend/src/api/generated/public/models/statusEnum.ts new file mode 100644 index 0000000..9194303 --- /dev/null +++ b/frontend/src/api/generated/public/models/statusEnum.ts @@ -0,0 +1,23 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * * `created` - cz#Vytvořeno + * `cancelled` - cz#Zrušeno + * `completed` - cz#Dokončeno + * `refunding` - cz#Vrácení v procesu + * `refunded` - cz#Vráceno + */ +export type StatusEnum = (typeof StatusEnum)[keyof typeof StatusEnum]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const StatusEnum = { + created: "created", + cancelled: "cancelled", + completed: "completed", + refunding: "refunding", + refunded: "refunded", +} as const; diff --git a/frontend/src/api/generated/public/models/trackingURL.ts b/frontend/src/api/generated/public/models/trackingURL.ts new file mode 100644 index 0000000..056d051 --- /dev/null +++ b/frontend/src/api/generated/public/models/trackingURL.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface TrackingURL { + readonly barcode: string; + readonly tracking_url: string; +} diff --git a/frontend/src/api/generated/public/models/userRegistration.ts b/frontend/src/api/generated/public/models/userRegistration.ts new file mode 100644 index 0000000..52db518 --- /dev/null +++ b/frontend/src/api/generated/public/models/userRegistration.ts @@ -0,0 +1,53 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface UserRegistration { + /** + * Křestní jméno uživatele + * @maxLength 150 + */ + first_name: string; + /** + * Příjmení uživatele + * @maxLength 150 + */ + last_name: string; + /** + * Emailová adresa uživatele + * @maxLength 254 + */ + email: string; + /** + * Telefonní číslo uživatele + * @maxLength 16 + * @nullable + * @pattern ^\+?\d{9,15}$ + */ + phone_number: string | null; + /** Heslo musí mít alespoň 8 znaků, obsahovat velká a malá písmena a číslici. */ + password: string; + /** + * Město uživatele + * @maxLength 100 + * @nullable + */ + city: string | null; + /** + * Ulice uživatele + * @maxLength 200 + * @nullable + */ + street: string | null; + /** + * PSČ uživatele + * @maxLength 5 + * @nullable + * @pattern ^\d{5}$ + */ + postal_code: string | null; + /** Souhlas se zpracováním osobních údajů */ + gdpr: boolean; +} diff --git a/frontend/src/api/generated/public/models/videoInfoResponse.ts b/frontend/src/api/generated/public/models/videoInfoResponse.ts new file mode 100644 index 0000000..9858144 --- /dev/null +++ b/frontend/src/api/generated/public/models/videoInfoResponse.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface VideoInfoResponse { + title: string; + /** @nullable */ + duration: number | null; + /** @nullable */ + thumbnail: string | null; + video_resolutions: string[]; + audio_resolutions: string[]; +} diff --git a/frontend/src/api/generated/public/models/zasilkovnaPacket.ts b/frontend/src/api/generated/public/models/zasilkovnaPacket.ts new file mode 100644 index 0000000..3164441 --- /dev/null +++ b/frontend/src/api/generated/public/models/zasilkovnaPacket.ts @@ -0,0 +1,32 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StateE15Enum } from "./stateE15Enum"; +import type { ZasilkovnaPacketReturnRouting } from "./zasilkovnaPacketReturnRouting"; + +export interface ZasilkovnaPacket { + readonly id: number; + readonly created_at: Date; + /** + * Číslo zásilky v Packetě (vraceno od API od Packety) + * @minimum -9223372036854776000 + * @maximum 9223372036854776000 + * @nullable + */ + packet_id?: number | null; + /** + * Čárový kód zásilky od Packety + * @nullable + */ + readonly barcode: string | null; + readonly state: StateE15Enum; + /** Hmotnost zásilky v gramech */ + readonly weight: number; + /** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ + readonly return_routing: ZasilkovnaPacketReturnRouting; +} diff --git a/frontend/src/api/generated/public/models/zasilkovnaPacketRead.ts b/frontend/src/api/generated/public/models/zasilkovnaPacketRead.ts new file mode 100644 index 0000000..a99eb56 --- /dev/null +++ b/frontend/src/api/generated/public/models/zasilkovnaPacketRead.ts @@ -0,0 +1,32 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import type { StateE15Enum } from "./stateE15Enum"; +import type { ZasilkovnaPacketReadReturnRouting } from "./zasilkovnaPacketReadReturnRouting"; + +export interface ZasilkovnaPacketRead { + readonly id: number; + readonly created_at: Date; + /** + * Číslo zásilky v Packetě (vraceno od API od Packety) + * @minimum -9223372036854776000 + * @maximum 9223372036854776000 + * @nullable + */ + packet_id?: number | null; + /** + * Čárový kód zásilky od Packety + * @nullable + */ + readonly barcode: string | null; + readonly state: StateE15Enum; + /** Hmotnost zásilky v gramech */ + readonly weight: number; + /** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ + readonly return_routing: ZasilkovnaPacketReadReturnRouting; +} diff --git a/frontend/src/api/generated/public/models/zasilkovnaPacketReadReturnRouting.ts b/frontend/src/api/generated/public/models/zasilkovnaPacketReadReturnRouting.ts new file mode 100644 index 0000000..cfcb819 --- /dev/null +++ b/frontend/src/api/generated/public/models/zasilkovnaPacketReadReturnRouting.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ +export type ZasilkovnaPacketReadReturnRouting = unknown | null; diff --git a/frontend/src/api/generated/public/models/zasilkovnaPacketReturnRouting.ts b/frontend/src/api/generated/public/models/zasilkovnaPacketReturnRouting.ts new file mode 100644 index 0000000..0cf56d3 --- /dev/null +++ b/frontend/src/api/generated/public/models/zasilkovnaPacketReturnRouting.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +/** + * Seznam 2 routing stringů pro vrácení zásilky + * @nullable + */ +export type ZasilkovnaPacketReturnRouting = unknown | null; diff --git a/frontend/src/api/generated/public/models/zasilkovnaShipment.ts b/frontend/src/api/generated/public/models/zasilkovnaShipment.ts new file mode 100644 index 0000000..7929af0 --- /dev/null +++ b/frontend/src/api/generated/public/models/zasilkovnaShipment.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ + +export interface ZasilkovnaShipment { + readonly id: number; + readonly created_at: Date; + /** ID zásilky v Packetě */ + readonly shipment_id: string; + /** Čárový kód zásilky v Packetě (format: ) */ + readonly barcode: string; + packets: number[]; +} diff --git a/frontend/src/api/generated/public/public.ts b/frontend/src/api/generated/public/public.ts new file mode 100644 index 0000000..476377a --- /dev/null +++ b/frontend/src/api/generated/public/public.ts @@ -0,0 +1,179 @@ +/** + * Generated by orval v7.17.0 🍺 + * Do not edit manually. + * OpenAPI spec version: 0.0.0 + */ +import { useQuery } from "@tanstack/react-query"; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseQueryOptions, + UseQueryResult, +} from "@tanstack/react-query"; + +import type { ApiChoicesRetrieve200, ApiChoicesRetrieveParams } from "./models"; + +import { publicMutator } from "../../publicClient"; + +/** + * Vrátí všechny možné hodnoty pro ChoiceField s podporou vícejazyčných labelů. Umožňuje načíst více modelů a polí najednou. + */ +export const apiChoicesRetrieve = ( + params: ApiChoicesRetrieveParams, + signal?: AbortSignal, +) => { + return publicMutator({ + url: `/api/choices/`, + method: "GET", + params, + signal, + }); +}; + +export const getApiChoicesRetrieveQueryKey = ( + params?: ApiChoicesRetrieveParams, +) => { + return [`/api/choices/`, ...(params ? [params] : [])] as const; +}; + +export const getApiChoicesRetrieveQueryOptions = < + TData = Awaited>, + TError = unknown, +>( + params: ApiChoicesRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, +) => { + const { query: queryOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getApiChoicesRetrieveQueryKey(params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => apiChoicesRetrieve(params, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type ApiChoicesRetrieveQueryResult = NonNullable< + Awaited> +>; +export type ApiChoicesRetrieveQueryError = unknown; + +export function useApiChoicesRetrieve< + TData = Awaited>, + TError = unknown, +>( + params: ApiChoicesRetrieveParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useApiChoicesRetrieve< + TData = Awaited>, + TError = unknown, +>( + params: ApiChoicesRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useApiChoicesRetrieve< + TData = Awaited>, + TError = unknown, +>( + params: ApiChoicesRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; + +export function useApiChoicesRetrieve< + TData = Awaited>, + TError = unknown, +>( + params: ApiChoicesRetrieveParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getApiChoicesRetrieveQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/frontend/src/orval.config.ts b/frontend/src/orval.config.ts index e035748..e8facf8 100644 --- a/frontend/src/orval.config.ts +++ b/frontend/src/orval.config.ts @@ -12,55 +12,63 @@ if (SKIP_ORVAL) { } export default defineConfig({ + // Public endpoints (all endpoints tagged with "public") public: { input: { target: `${backendUrl}/api/schema/`, - filters: { mode: "include", tags: ["public"], }, }, output: { - target: "api/generated/public.ts", + target: "api/generated/public/index.ts", schemas: "api/generated/public/models", - mode: "tags", clean: true, - client: "react-query", httpClient: "axios", - override: { mutator: { - path: "api/publicClient.ts", //IMPORTANTE + path: "api/publicClient.ts", name: "publicMutator", }, + formUrlEncoded: true, + useDates: true, }, }, hooks: { afterAllFilesWrite: 'prettier --write', } }, + + // All private endpoints (organized by tags, shared models folder) private: { input: { target: `${backendUrl}/api/schema/`, + filters: { + mode: "exclude", + tags: ["public"], // Exclude public endpoints, include everything else + }, }, output: { - target: "api/generated/private.ts", //IMPORTANTE + target: "api/generated/private", schemas: "api/generated/private/models", - - mode: "tags", + mode: "tags-split", // Split by tag into separate files clean: true, - client: "react-query", httpClient: "axios", - override: { mutator: { path: "api/privateClient.ts", name: "privateMutator", }, + formUrlEncoded: true, + useDates: true, + query: { + useQuery: true, + useInfinite: false, // Disable infinite queries to avoid page param errors + }, }, }, hooks: { diff --git a/frontend/src/pages/downloader/Downloader.tsx b/frontend/src/pages/downloader/Downloader.tsx index e1e0820..c386378 100644 --- a/frontend/src/pages/downloader/Downloader.tsx +++ b/frontend/src/pages/downloader/Downloader.tsx @@ -1,8 +1,60 @@ +import { useState } from 'react'; +import { useApiDownloaderDownloadRetrieve } from '@/api/generated/public/downloader'; + export default function Downloader() { + const [videoUrl, setVideoUrl] = useState(''); + + // The hook needs: (params, options) + // params = { url: string } + // options = { query: { enabled: boolean } } + const { data: videoInfo, isLoading, error } = useApiDownloaderDownloadRetrieve( + { url: videoUrl }, // 1st arg: parameters + { + query: { + enabled: videoUrl.length > 10, // 2nd arg: query options (only fetch when URL is valid) + } + } + ); return ( - <> - not implemented yet - +
+

Video Downloader

+ + setVideoUrl(e.target.value)} + placeholder="Paste video URL here" + className="w-full p-2 border rounded mb-4" + /> + + {isLoading &&

Loading video info...

} + + {error &&

Error: {error?.error}

} + + {videoInfo && ( +
+

{videoInfo.title}

+ {videoInfo.thumbnail && ( + {videoInfo.title} + )} +

Duration: {videoInfo.duration}s

+ +

Available Video Qualities:

+
    + {videoInfo.video_resolutions?.map((res) => ( +
  • {res}
  • + ))} +
+ +

Available Audio Qualities:

+
    + {videoInfo.audio_resolutions?.map((res) => ( +
  • {res}
  • + ))} +
+
+ )} +
); } \ No newline at end of file diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json index 227a6c6..d075f3e 100644 --- a/frontend/tsconfig.app.json +++ b/frontend/tsconfig.app.json @@ -21,7 +21,13 @@ "noUnusedParameters": true, "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true + "noUncheckedSideEffectImports": true, + + /* Path Mapping */ + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } }, "include": ["src"] } diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 5bb8217..997e6e5 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'vite' import tailwindcss from '@tailwindcss/vite' import react from '@vitejs/plugin-react' +import path from 'path' // https://vite.dev/config/ export default defineConfig({ @@ -8,4 +9,9 @@ export default defineConfig({ react(), tailwindcss() ], + resolve: { + alias: { + '@': path.resolve(__dirname, './src'), + }, + }, })