// This file is auto-generated by @hey-api/openapi-ts import { infiniteQueryOptions, queryOptions, type DefaultError, type InfiniteData, type UseMutationOptions, } from "@tanstack/react-query"; import type { AxiosError } from "axios"; import { client as _heyApiClient } from "../client.gen"; import { addAttributeToModule, addKitToDeal, addKitToDealProduct, createAttribute, createBarcodeTemplate, createBoard, createClient, createDeal, createDealGroup, createDealProduct, createDealProductService, createDealService, createDealTag, createMarketplace, createModule, createProduct, createProject, createService, createServiceCategory, createServicesKit, createStatus, deleteAttribute, deleteBarcodeTemplate, deleteBoard, deleteClient, deleteDeal, deleteDealGroup, deleteDealProduct, deleteDealProductService, deleteDealService, deleteDealTag, deleteMarketplace, deleteModule, deleteProduct, deleteProductBarcodeImage, deleteProject, deleteService, deleteServiceCategory, deleteServicesKit, deleteStatus, duplicateProductServices, getAttributes, getAttributeTypes, getAttrSelectOptions, getAttrSelects, getBarcodeTemplateAttributes, getBarcodeTemplates, getBarcodeTemplateSizes, getBaseMarketplaces, getBoards, getClients, getDealBarcodesPdf, getDealModuleAttributes, getDealProducts, getDeals, getDealServices, getDealTagColors, getDealTags, getMarketplaces, getModules, getModulesWithAttributes, getModuleWithAttributes, getProductBarcodePdf, getProducts, getProjects, getServiceCategories, getServices, getServicesKits, getStatuses, getStatusHistory, removeAttributeFromModule, switchDealTag, updateAttribute, updateAttributeLabel, updateBarcodeTemplate, updateBoard, updateClient, updateDeal, updateDealGroup, updateDealModuleAttributes, updateDealProduct, updateDealProductService, updateDealService, updateDealsInGroup, updateDealTag, updateMarketplace, updateModule, updateProduct, updateProject, updateService, updateServiceCategory, updateServicesKit, updateStatus, uploadProductBarcodeImage, uploadProductImage, type Options, } from "../sdk.gen"; import type { AddAttributeToModuleData, AddAttributeToModuleError, AddAttributeToModuleResponse, AddKitToDealData, AddKitToDealError, AddKitToDealProductData, AddKitToDealProductError, AddKitToDealProductResponse, AddKitToDealResponse, CreateAttributeData, CreateAttributeError, CreateAttributeResponse2, CreateBarcodeTemplateData, CreateBarcodeTemplateError, CreateBarcodeTemplateResponse2, CreateBoardData, CreateBoardError, CreateBoardResponse2, CreateClientData, CreateClientError, CreateClientResponse2, CreateDealData, CreateDealError, CreateDealGroupData, CreateDealGroupError, CreateDealGroupResponse2, CreateDealProductData, CreateDealProductError, CreateDealProductResponse2, CreateDealProductServiceData, CreateDealProductServiceError, CreateDealProductServiceResponse, CreateDealResponse2, CreateDealServiceData, CreateDealServiceError, CreateDealServiceResponse2, CreateDealTagData, CreateDealTagError, CreateDealTagResponse2, CreateMarketplaceData, CreateMarketplaceError, CreateMarketplaceResponse2, CreateModuleData, CreateModuleError, CreateModuleResponse2, CreateProductData, CreateProductError, CreateProductResponse2, CreateProjectData, CreateProjectError, CreateProjectResponse2, CreateServiceCategoryData, CreateServiceCategoryError, CreateServiceCategoryResponse2, CreateServiceData, CreateServiceError, CreateServiceResponse2, CreateServicesKitData, CreateServicesKitError, CreateServicesKitResponse2, CreateStatusData, CreateStatusError, CreateStatusResponse2, DeleteAttributeData, DeleteAttributeError, DeleteAttributeResponse2, DeleteBarcodeTemplateData, DeleteBarcodeTemplateError, DeleteBarcodeTemplateResponse2, DeleteBoardData, DeleteBoardError, DeleteBoardResponse2, DeleteClientData, DeleteClientError, DeleteClientResponse2, DeleteDealData, DeleteDealError, DeleteDealGroupData, DeleteDealGroupError, DeleteDealGroupResponse2, DeleteDealProductData, DeleteDealProductError, DeleteDealProductResponse2, DeleteDealProductServiceData, DeleteDealProductServiceError, DeleteDealProductServiceResponse, DeleteDealResponse2, DeleteDealServiceData, DeleteDealServiceError, DeleteDealServiceResponse2, DeleteDealTagData, DeleteDealTagError, DeleteDealTagResponse2, DeleteMarketplaceData, DeleteMarketplaceError, DeleteMarketplaceResponse2, DeleteModuleData, DeleteModuleError, DeleteModuleResponse2, DeleteProductBarcodeImageData, DeleteProductBarcodeImageError, DeleteProductBarcodeImageResponse, DeleteProductData, DeleteProductError, DeleteProductResponse2, DeleteProjectData, DeleteProjectError, DeleteProjectResponse2, DeleteServiceCategoryData, DeleteServiceCategoryError, DeleteServiceCategoryResponse2, DeleteServiceData, DeleteServiceError, DeleteServiceResponse2, DeleteServicesKitData, DeleteServicesKitError, DeleteServicesKitResponse2, DeleteStatusData, DeleteStatusError, DeleteStatusResponse2, DuplicateProductServicesData, DuplicateProductServicesError, DuplicateProductServicesResponse, GetAttributesData, GetAttributeTypesData, GetAttrSelectOptionsData, GetAttrSelectsData, GetBarcodeTemplateAttributesData, GetBarcodeTemplatesData, GetBarcodeTemplateSizesData, GetBaseMarketplacesData, GetBoardsData, GetClientsData, GetDealBarcodesPdfData, GetDealBarcodesPdfError, GetDealBarcodesPdfResponse2, GetDealModuleAttributesData, GetDealProductsData, GetDealsData, GetDealsError, GetDealServicesData, GetDealsResponse2, GetDealTagColorsData, GetDealTagColorsResponse, GetDealTagsData, GetMarketplacesData, GetModulesData, GetModulesWithAttributesData, GetModuleWithAttributesData, GetProductBarcodePdfData, GetProductBarcodePdfError, GetProductBarcodePdfResponse2, GetProductsData, GetProductsError, GetProductsResponse2, GetProjectsData, GetServiceCategoriesData, GetServicesData, GetServicesKitsData, GetStatusesData, GetStatusHistoryData, RemoveAttributeFromModuleData, RemoveAttributeFromModuleError, RemoveAttributeFromModuleResponse, SwitchDealTagData, SwitchDealTagError, SwitchDealTagResponse2, UpdateAttributeData, UpdateAttributeError, UpdateAttributeLabelData, UpdateAttributeLabelError, UpdateAttributeLabelResponse2, UpdateAttributeResponse2, UpdateBarcodeTemplateData, UpdateBarcodeTemplateError, UpdateBarcodeTemplateResponse2, UpdateBoardData, UpdateBoardError, UpdateBoardResponse2, UpdateClientData, UpdateClientError, UpdateClientResponse2, UpdateDealData, UpdateDealError, UpdateDealGroupData, UpdateDealGroupError, UpdateDealGroupResponse2, UpdateDealModuleAttributesData, UpdateDealModuleAttributesError, UpdateDealModuleAttributesResponse2, UpdateDealProductData, UpdateDealProductError, UpdateDealProductResponse2, UpdateDealProductServiceData, UpdateDealProductServiceError, UpdateDealProductServiceResponse, UpdateDealResponse2, UpdateDealServiceData, UpdateDealServiceError, UpdateDealServiceResponse2, UpdateDealsInGroupData, UpdateDealsInGroupError, UpdateDealsInGroupResponse2, UpdateDealTagData, UpdateDealTagError, UpdateDealTagResponse2, UpdateMarketplaceData, UpdateMarketplaceError, UpdateMarketplaceResponse2, UpdateModuleData, UpdateModuleError, UpdateModuleResponse, UpdateProductData, UpdateProductError, UpdateProductResponse2, UpdateProjectData, UpdateProjectError, UpdateProjectResponse2, UpdateServiceCategoryData, UpdateServiceCategoryError, UpdateServiceCategoryResponse2, UpdateServiceData, UpdateServiceError, UpdateServiceResponse2, UpdateServicesKitData, UpdateServicesKitError, UpdateServicesKitResponse2, UpdateStatusData, UpdateStatusError, UpdateStatusResponse2, UploadProductBarcodeImageData, UploadProductBarcodeImageError, UploadProductBarcodeImageResponse, UploadProductImageData, UploadProductImageError, UploadProductImageResponse, } from "../types.gen"; export type QueryKey = [ Pick & { _id: string; _infinite?: boolean; }, ]; const createQueryKey = ( id: string, options?: TOptions, infinite?: boolean ): [QueryKey[0]] => { const params: QueryKey[0] = { _id: id, baseURL: options?.baseURL || (options?.client ?? _heyApiClient).getConfig().baseURL, } as QueryKey[0]; if (infinite) { params._infinite = infinite; } if (options?.body) { params.body = options.body; } if (options?.headers) { params.headers = options.headers; } if (options?.path) { params.path = options.path; } if (options?.query) { params.query = options.query; } return [params]; }; export const getAttrSelectsQueryKey = (options?: Options) => createQueryKey("getAttrSelects", options); /** * Get Attr Selects */ export const getAttrSelectsOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getAttrSelects({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getAttrSelectsQueryKey(options), }); }; export const getAttrSelectOptionsQueryKey = ( options: Options ) => createQueryKey("getAttrSelectOptions", options); /** * Get Attr Select Options */ export const getAttrSelectOptionsOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getAttrSelectOptions({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getAttrSelectOptionsQueryKey(options), }); }; export const getAttributesQueryKey = (options?: Options) => createQueryKey("getAttributes", options); /** * Get Attributes */ export const getAttributesOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getAttributes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getAttributesQueryKey(options), }); }; export const createAttributeQueryKey = ( options: Options ) => createQueryKey("createAttribute", options); /** * Create Attribute */ export const createAttributeOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createAttribute({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createAttributeQueryKey(options), }); }; /** * Create Attribute */ export const createAttributeMutation = ( options?: Partial> ): UseMutationOptions< CreateAttributeResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateAttributeResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createAttribute({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Attribute */ export const deleteAttributeMutation = ( options?: Partial> ): UseMutationOptions< DeleteAttributeResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteAttributeResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteAttribute({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Attribute */ export const updateAttributeMutation = ( options?: Partial> ): UseMutationOptions< UpdateAttributeResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateAttributeResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateAttribute({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const updateAttributeLabelQueryKey = ( options: Options ) => createQueryKey("updateAttributeLabel", options); /** * Update Attribute Label */ export const updateAttributeLabelOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await updateAttributeLabel({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: updateAttributeLabelQueryKey(options), }); }; /** * Update Attribute Label */ export const updateAttributeLabelMutation = ( options?: Partial> ): UseMutationOptions< UpdateAttributeLabelResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateAttributeLabelResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateAttributeLabel({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getAttributeTypesQueryKey = ( options?: Options ) => createQueryKey("getAttributeTypes", options); /** * Get Attribute Types */ export const getAttributeTypesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getAttributeTypes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getAttributeTypesQueryKey(options), }); }; export const getDealModuleAttributesQueryKey = ( options: Options ) => createQueryKey("getDealModuleAttributes", options); /** * Get Deal Module Attributes */ export const getDealModuleAttributesOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDealModuleAttributes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealModuleAttributesQueryKey(options), }); }; export const updateDealModuleAttributesQueryKey = ( options: Options ) => createQueryKey("updateDealModuleAttributes", options); /** * Update Deal Module Attributes */ export const updateDealModuleAttributesOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await updateDealModuleAttributes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: updateDealModuleAttributesQueryKey(options), }); }; /** * Update Deal Module Attributes */ export const updateDealModuleAttributesMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealModuleAttributesResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealModuleAttributesResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealModuleAttributes({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getBoardsQueryKey = (options: Options) => createQueryKey("getBoards", options); /** * Get Boards */ export const getBoardsOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getBoards({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getBoardsQueryKey(options), }); }; export const createBoardQueryKey = (options: Options) => createQueryKey("createBoard", options); /** * Create Board */ export const createBoardOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createBoard({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createBoardQueryKey(options), }); }; /** * Create Board */ export const createBoardMutation = ( options?: Partial> ): UseMutationOptions< CreateBoardResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateBoardResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createBoard({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Board */ export const deleteBoardMutation = ( options?: Partial> ): UseMutationOptions< DeleteBoardResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteBoardResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteBoard({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Board */ export const updateBoardMutation = ( options?: Partial> ): UseMutationOptions< UpdateBoardResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateBoardResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateBoard({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getDealsQueryKey = (options?: Options) => createQueryKey("getDeals", options); /** * Get Deals */ export const getDealsOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDeals({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealsQueryKey(options), }); }; const createInfiniteParams = < K extends Pick[0], "body" | "headers" | "path" | "query">, >( queryKey: QueryKey, page: K ) => { const params = { ...queryKey[0], }; if (page.body) { params.body = { ...(queryKey[0].body as any), ...(page.body as any), }; } if (page.headers) { params.headers = { ...queryKey[0].headers, ...page.headers, }; } if (page.path) { params.path = { ...(queryKey[0].path as any), ...(page.path as any), }; } if (page.query) { params.query = { ...(queryKey[0].query as any), ...(page.query as any), }; } return params as unknown as typeof page; }; export const getDealsInfiniteQueryKey = ( options?: Options ): QueryKey> => createQueryKey("getDeals", options, true); /** * Get Deals */ export const getDealsInfiniteOptions = (options?: Options) => { return infiniteQueryOptions< GetDealsResponse2, AxiosError, InfiniteData, QueryKey>, | number | null | Pick< QueryKey>[0], "body" | "headers" | "path" | "query" > >( // @ts-ignore { queryFn: async ({ pageParam, queryKey, signal }) => { // @ts-ignore const page: Pick< QueryKey>[0], "body" | "headers" | "path" | "query" > = typeof pageParam === "object" ? pageParam : { query: { page: pageParam, }, }; const params = createInfiniteParams(queryKey, page); const { data } = await getDeals({ ...options, ...params, signal, throwOnError: true, }); return data; }, queryKey: getDealsInfiniteQueryKey(options), } ); }; export const createDealQueryKey = (options: Options) => createQueryKey("createDeal", options); /** * Create Deal */ export const createDealOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createDeal({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createDealQueryKey(options), }); }; /** * Create Deal */ export const createDealMutation = ( options?: Partial> ): UseMutationOptions< CreateDealResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateDealResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createDeal({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Deal */ export const deleteDealMutation = ( options?: Partial> ): UseMutationOptions< DeleteDealResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteDealResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteDeal({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Deal */ export const updateDealMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDeal({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Group */ export const deleteDealGroupMutation = ( options?: Partial> ): UseMutationOptions< DeleteDealGroupResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteDealGroupResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteDealGroup({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Group */ export const updateDealGroupMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealGroupResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealGroupResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealGroup({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const createDealGroupQueryKey = ( options: Options ) => createQueryKey("createDealGroup", options); /** * Create Group */ export const createDealGroupOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createDealGroup({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createDealGroupQueryKey(options), }); }; /** * Create Group */ export const createDealGroupMutation = ( options?: Partial> ): UseMutationOptions< CreateDealGroupResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateDealGroupResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createDealGroup({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const updateDealsInGroupQueryKey = ( options: Options ) => createQueryKey("updateDealsInGroup", options); /** * Update Deals In Group */ export const updateDealsInGroupOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await updateDealsInGroup({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: updateDealsInGroupQueryKey(options), }); }; /** * Update Deals In Group */ export const updateDealsInGroupMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealsInGroupResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealsInGroupResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealsInGroup({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getDealTagsQueryKey = (options: Options) => createQueryKey("getDealTags", options); /** * Get Deal Tags */ export const getDealTagsOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDealTags({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealTagsQueryKey(options), }); }; export const createDealTagQueryKey = (options: Options) => createQueryKey("createDealTag", options); /** * Create Deal Tag */ export const createDealTagOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createDealTag({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createDealTagQueryKey(options), }); }; /** * Create Deal Tag */ export const createDealTagMutation = ( options?: Partial> ): UseMutationOptions< CreateDealTagResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateDealTagResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createDealTag({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Deal Tag */ export const deleteDealTagMutation = ( options?: Partial> ): UseMutationOptions< DeleteDealTagResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteDealTagResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteDealTag({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Deal Tag */ export const updateDealTagMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealTagResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealTagResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealTag({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const switchDealTagQueryKey = (options: Options) => createQueryKey("switchDealTag", options); /** * Switch Deal Tag */ export const switchDealTagOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await switchDealTag({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: switchDealTagQueryKey(options), }); }; /** * Switch Deal Tag */ export const switchDealTagMutation = ( options?: Partial> ): UseMutationOptions< SwitchDealTagResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< SwitchDealTagResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await switchDealTag({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getDealTagColorsQueryKey = ( options?: Options ) => createQueryKey("getDealTagColors", options); /** * Get Deal Tag Colors */ export const getDealTagColorsOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDealTagColors({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealTagColorsQueryKey(options), }); }; /** * Get Deal Tag Colors */ export const getDealTagColorsMutation = ( options?: Partial> ): UseMutationOptions< GetDealTagColorsResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< GetDealTagColorsResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await getDealTagColors({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getModulesQueryKey = (options?: Options) => createQueryKey("getModules", options); /** * Get Modules */ export const getModulesOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getModules({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getModulesQueryKey(options), }); }; export const createModuleQueryKey = (options: Options) => createQueryKey("createModule", options); /** * Create Module */ export const createModuleOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createModule({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createModuleQueryKey(options), }); }; /** * Create Module */ export const createModuleMutation = ( options?: Partial> ): UseMutationOptions< CreateModuleResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateModuleResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createModule({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getModulesWithAttributesQueryKey = ( options?: Options ) => createQueryKey("getModulesWithAttributes", options); /** * Get Modules With Attributes */ export const getModulesWithAttributesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getModulesWithAttributes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getModulesWithAttributesQueryKey(options), }); }; export const getModuleWithAttributesQueryKey = ( options: Options ) => createQueryKey("getModuleWithAttributes", options); /** * Get Module With Attributes */ export const getModuleWithAttributesOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getModuleWithAttributes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getModuleWithAttributesQueryKey(options), }); }; /** * Update Module Common Info */ export const updateModuleMutation = ( options?: Partial> ): UseMutationOptions< UpdateModuleResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateModuleResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateModule({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Module */ export const deleteModuleMutation = ( options?: Partial> ): UseMutationOptions< DeleteModuleResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteModuleResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteModule({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Remove Attribute From Module */ export const removeAttributeFromModuleMutation = ( options?: Partial> ): UseMutationOptions< RemoveAttributeFromModuleResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< RemoveAttributeFromModuleResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await removeAttributeFromModule({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const addAttributeToModuleQueryKey = ( options: Options ) => createQueryKey("addAttributeToModule", options); /** * Add Attribute To Module */ export const addAttributeToModuleOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await addAttributeToModule({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: addAttributeToModuleQueryKey(options), }); }; /** * Add Attribute To Module */ export const addAttributeToModuleMutation = ( options?: Partial> ): UseMutationOptions< AddAttributeToModuleResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< AddAttributeToModuleResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await addAttributeToModule({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getClientsQueryKey = (options?: Options) => createQueryKey("getClients", options); /** * Get Clients */ export const getClientsOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getClients({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getClientsQueryKey(options), }); }; export const createClientQueryKey = (options: Options) => createQueryKey("createClient", options); /** * Create Client */ export const createClientOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createClient({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createClientQueryKey(options), }); }; /** * Create Client */ export const createClientMutation = ( options?: Partial> ): UseMutationOptions< CreateClientResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateClientResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createClient({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Product */ export const deleteClientMutation = ( options?: Partial> ): UseMutationOptions< DeleteClientResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteClientResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteClient({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Client */ export const updateClientMutation = ( options?: Partial> ): UseMutationOptions< UpdateClientResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateClientResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateClient({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getBarcodeTemplatesQueryKey = ( options?: Options ) => createQueryKey("getBarcodeTemplates", options); /** * Get Barcode Templates */ export const getBarcodeTemplatesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getBarcodeTemplates({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getBarcodeTemplatesQueryKey(options), }); }; export const createBarcodeTemplateQueryKey = ( options: Options ) => createQueryKey("createBarcodeTemplate", options); /** * Create Barcode Template */ export const createBarcodeTemplateOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createBarcodeTemplate({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createBarcodeTemplateQueryKey(options), }); }; /** * Create Barcode Template */ export const createBarcodeTemplateMutation = ( options?: Partial> ): UseMutationOptions< CreateBarcodeTemplateResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateBarcodeTemplateResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createBarcodeTemplate({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Barcode Template */ export const deleteBarcodeTemplateMutation = ( options?: Partial> ): UseMutationOptions< DeleteBarcodeTemplateResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteBarcodeTemplateResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteBarcodeTemplate({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Barcode Template */ export const updateBarcodeTemplateMutation = ( options?: Partial> ): UseMutationOptions< UpdateBarcodeTemplateResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateBarcodeTemplateResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateBarcodeTemplate({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getBarcodeTemplateAttributesQueryKey = ( options?: Options ) => createQueryKey("getBarcodeTemplateAttributes", options); /** * Get Barcode Template Attributes */ export const getBarcodeTemplateAttributesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getBarcodeTemplateAttributes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getBarcodeTemplateAttributesQueryKey(options), }); }; export const getBarcodeTemplateSizesQueryKey = ( options?: Options ) => createQueryKey("getBarcodeTemplateSizes", options); /** * Get Barcode Template Sizes */ export const getBarcodeTemplateSizesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getBarcodeTemplateSizes({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getBarcodeTemplateSizesQueryKey(options), }); }; export const getDealProductsQueryKey = ( options: Options ) => createQueryKey("getDealProducts", options); /** * Get Deal Products */ export const getDealProductsOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDealProducts({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealProductsQueryKey(options), }); }; export const createDealProductQueryKey = ( options: Options ) => createQueryKey("createDealProduct", options); /** * Create Deal Product */ export const createDealProductOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createDealProduct({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createDealProductQueryKey(options), }); }; /** * Create Deal Product */ export const createDealProductMutation = ( options?: Partial> ): UseMutationOptions< CreateDealProductResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateDealProductResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createDealProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Deal Product */ export const deleteDealProductMutation = ( options?: Partial> ): UseMutationOptions< DeleteDealProductResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteDealProductResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteDealProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Deal Product */ export const updateDealProductMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealProductResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealProductResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const createDealProductServiceQueryKey = ( options: Options ) => createQueryKey("createDealProductService", options); /** * Create Deal Product Service */ export const createDealProductServiceOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createDealProductService({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createDealProductServiceQueryKey(options), }); }; /** * Create Deal Product Service */ export const createDealProductServiceMutation = ( options?: Partial> ): UseMutationOptions< CreateDealProductServiceResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateDealProductServiceResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createDealProductService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Deal Product Service */ export const deleteDealProductServiceMutation = ( options?: Partial> ): UseMutationOptions< DeleteDealProductServiceResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteDealProductServiceResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteDealProductService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Deal Product Service */ export const updateDealProductServiceMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealProductServiceResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealProductServiceResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealProductService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const duplicateProductServicesQueryKey = ( options: Options ) => createQueryKey("duplicateProductServices", options); /** * Copy Product Services */ export const duplicateProductServicesOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await duplicateProductServices({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: duplicateProductServicesQueryKey(options), }); }; /** * Copy Product Services */ export const duplicateProductServicesMutation = ( options?: Partial> ): UseMutationOptions< DuplicateProductServicesResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DuplicateProductServicesResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await duplicateProductServices({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const addKitToDealProductQueryKey = ( options: Options ) => createQueryKey("addKitToDealProduct", options); /** * Add Kit To Deal Product */ export const addKitToDealProductOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await addKitToDealProduct({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: addKitToDealProductQueryKey(options), }); }; /** * Add Kit To Deal Product */ export const addKitToDealProductMutation = ( options?: Partial> ): UseMutationOptions< AddKitToDealProductResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< AddKitToDealProductResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await addKitToDealProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getDealServicesQueryKey = ( options: Options ) => createQueryKey("getDealServices", options); /** * Get Deal Services */ export const getDealServicesOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDealServices({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealServicesQueryKey(options), }); }; export const createDealServiceQueryKey = ( options: Options ) => createQueryKey("createDealService", options); /** * Create Deal Service */ export const createDealServiceOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createDealService({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createDealServiceQueryKey(options), }); }; /** * Create Deal Service */ export const createDealServiceMutation = ( options?: Partial> ): UseMutationOptions< CreateDealServiceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateDealServiceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createDealService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Deal Service */ export const deleteDealServiceMutation = ( options?: Partial> ): UseMutationOptions< DeleteDealServiceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteDealServiceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteDealService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Deal Service */ export const updateDealServiceMutation = ( options?: Partial> ): UseMutationOptions< UpdateDealServiceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateDealServiceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateDealService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const addKitToDealQueryKey = (options: Options) => createQueryKey("addKitToDeal", options); /** * Add Kit To Deal */ export const addKitToDealOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await addKitToDeal({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: addKitToDealQueryKey(options), }); }; /** * Add Kit To Deal */ export const addKitToDealMutation = ( options?: Partial> ): UseMutationOptions< AddKitToDealResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< AddKitToDealResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await addKitToDeal({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getBaseMarketplacesQueryKey = ( options?: Options ) => createQueryKey("getBaseMarketplaces", options); /** * Get Base Marketplaces */ export const getBaseMarketplacesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getBaseMarketplaces({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getBaseMarketplacesQueryKey(options), }); }; export const getMarketplacesQueryKey = ( options: Options ) => createQueryKey("getMarketplaces", options); /** * Get Marketplaces */ export const getMarketplacesOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getMarketplaces({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getMarketplacesQueryKey(options), }); }; export const createMarketplaceQueryKey = ( options: Options ) => createQueryKey("createMarketplace", options); /** * Create Product */ export const createMarketplaceOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createMarketplace({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createMarketplaceQueryKey(options), }); }; /** * Create Product */ export const createMarketplaceMutation = ( options?: Partial> ): UseMutationOptions< CreateMarketplaceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateMarketplaceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createMarketplace({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Marketplace */ export const deleteMarketplaceMutation = ( options?: Partial> ): UseMutationOptions< DeleteMarketplaceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteMarketplaceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteMarketplace({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Marketplace */ export const updateMarketplaceMutation = ( options?: Partial> ): UseMutationOptions< UpdateMarketplaceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateMarketplaceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateMarketplace({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getProductsQueryKey = (options?: Options) => createQueryKey("getProducts", options); /** * Get Products */ export const getProductsOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getProducts({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getProductsQueryKey(options), }); }; export const getProductsInfiniteQueryKey = ( options?: Options ): QueryKey> => createQueryKey("getProducts", options, true); /** * Get Products */ export const getProductsInfiniteOptions = ( options?: Options ) => { return infiniteQueryOptions< GetProductsResponse2, AxiosError, InfiniteData, QueryKey>, | number | null | Pick< QueryKey>[0], "body" | "headers" | "path" | "query" > >( // @ts-ignore { queryFn: async ({ pageParam, queryKey, signal }) => { // @ts-ignore const page: Pick< QueryKey>[0], "body" | "headers" | "path" | "query" > = typeof pageParam === "object" ? pageParam : { query: { page: pageParam, }, }; const params = createInfiniteParams(queryKey, page); const { data } = await getProducts({ ...options, ...params, signal, throwOnError: true, }); return data; }, queryKey: getProductsInfiniteQueryKey(options), } ); }; export const createProductQueryKey = (options: Options) => createQueryKey("createProduct", options); /** * Create Product */ export const createProductOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createProduct({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createProductQueryKey(options), }); }; /** * Create Product */ export const createProductMutation = ( options?: Partial> ): UseMutationOptions< CreateProductResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateProductResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Product */ export const deleteProductMutation = ( options?: Partial> ): UseMutationOptions< DeleteProductResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteProductResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Product */ export const updateProductMutation = ( options?: Partial> ): UseMutationOptions< UpdateProductResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateProductResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateProduct({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const uploadProductImageQueryKey = ( options: Options ) => createQueryKey("uploadProductImage", options); /** * Upload Product Image */ export const uploadProductImageOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await uploadProductImage({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: uploadProductImageQueryKey(options), }); }; /** * Upload Product Image */ export const uploadProductImageMutation = ( options?: Partial> ): UseMutationOptions< UploadProductImageResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UploadProductImageResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await uploadProductImage({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getProductBarcodePdfQueryKey = ( options: Options ) => createQueryKey("getProductBarcodePdf", options); /** * Get Product Barcode Pdf */ export const getProductBarcodePdfOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getProductBarcodePdf({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getProductBarcodePdfQueryKey(options), }); }; /** * Get Product Barcode Pdf */ export const getProductBarcodePdfMutation = ( options?: Partial> ): UseMutationOptions< GetProductBarcodePdfResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< GetProductBarcodePdfResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await getProductBarcodePdf({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getDealBarcodesPdfQueryKey = ( options: Options ) => createQueryKey("getDealBarcodesPdf", options); /** * Get Deal Barcodes Pdf */ export const getDealBarcodesPdfOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getDealBarcodesPdf({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getDealBarcodesPdfQueryKey(options), }); }; /** * Get Deal Barcodes Pdf */ export const getDealBarcodesPdfMutation = ( options?: Partial> ): UseMutationOptions< GetDealBarcodesPdfResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< GetDealBarcodesPdfResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await getDealBarcodesPdf({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const uploadProductBarcodeImageQueryKey = ( options: Options ) => createQueryKey("uploadProductBarcodeImage", options); /** * Upload Product Barcode Image */ export const uploadProductBarcodeImageOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await uploadProductBarcodeImage({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: uploadProductBarcodeImageQueryKey(options), }); }; /** * Upload Product Barcode Image */ export const uploadProductBarcodeImageMutation = ( options?: Partial> ): UseMutationOptions< UploadProductBarcodeImageResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UploadProductBarcodeImageResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await uploadProductBarcodeImage({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Product Barcode Image */ export const deleteProductBarcodeImageMutation = ( options?: Partial> ): UseMutationOptions< DeleteProductBarcodeImageResponse, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteProductBarcodeImageResponse, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteProductBarcodeImage({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getServicesQueryKey = (options?: Options) => createQueryKey("getServices", options); /** * Get Services */ export const getServicesOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getServices({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getServicesQueryKey(options), }); }; export const createServiceQueryKey = (options: Options) => createQueryKey("createService", options); /** * Create Service */ export const createServiceOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createService({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createServiceQueryKey(options), }); }; /** * Create Service */ export const createServiceMutation = ( options?: Partial> ): UseMutationOptions< CreateServiceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateServiceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Service */ export const deleteServiceMutation = ( options?: Partial> ): UseMutationOptions< DeleteServiceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteServiceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Service */ export const updateServiceMutation = ( options?: Partial> ): UseMutationOptions< UpdateServiceResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateServiceResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateService({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getServiceCategoriesQueryKey = ( options?: Options ) => createQueryKey("getServiceCategories", options); /** * Get Services Categories */ export const getServiceCategoriesOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getServiceCategories({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getServiceCategoriesQueryKey(options), }); }; export const createServiceCategoryQueryKey = ( options: Options ) => createQueryKey("createServiceCategory", options); /** * Create Service Category */ export const createServiceCategoryOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createServiceCategory({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createServiceCategoryQueryKey(options), }); }; /** * Create Service Category */ export const createServiceCategoryMutation = ( options?: Partial> ): UseMutationOptions< CreateServiceCategoryResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateServiceCategoryResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createServiceCategory({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Service Category */ export const deleteServiceCategoryMutation = ( options?: Partial> ): UseMutationOptions< DeleteServiceCategoryResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteServiceCategoryResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteServiceCategory({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Service Category */ export const updateServiceCategoryMutation = ( options?: Partial> ): UseMutationOptions< UpdateServiceCategoryResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateServiceCategoryResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateServiceCategory({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getServicesKitsQueryKey = ( options?: Options ) => createQueryKey("getServicesKits", options); /** * Get Services Kits */ export const getServicesKitsOptions = ( options?: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getServicesKits({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getServicesKitsQueryKey(options), }); }; export const createServicesKitQueryKey = ( options: Options ) => createQueryKey("createServicesKit", options); /** * Create Services Kit */ export const createServicesKitOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createServicesKit({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createServicesKitQueryKey(options), }); }; /** * Create Services Kit */ export const createServicesKitMutation = ( options?: Partial> ): UseMutationOptions< CreateServicesKitResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateServicesKitResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createServicesKit({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Services Kit */ export const deleteServicesKitMutation = ( options?: Partial> ): UseMutationOptions< DeleteServicesKitResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteServicesKitResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteServicesKit({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Services Kit */ export const updateServicesKitMutation = ( options?: Partial> ): UseMutationOptions< UpdateServicesKitResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateServicesKitResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateServicesKit({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getProjectsQueryKey = (options?: Options) => createQueryKey("getProjects", options); /** * Get Projects */ export const getProjectsOptions = (options?: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getProjects({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getProjectsQueryKey(options), }); }; export const createProjectQueryKey = (options: Options) => createQueryKey("createProject", options); /** * Create Project */ export const createProjectOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createProject({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createProjectQueryKey(options), }); }; /** * Create Project */ export const createProjectMutation = ( options?: Partial> ): UseMutationOptions< CreateProjectResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateProjectResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createProject({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Project */ export const deleteProjectMutation = ( options?: Partial> ): UseMutationOptions< DeleteProjectResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteProjectResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteProject({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Project */ export const updateProjectMutation = ( options?: Partial> ): UseMutationOptions< UpdateProjectResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateProjectResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateProject({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getStatusesQueryKey = (options: Options) => createQueryKey("getStatuses", options); /** * Get Statuses */ export const getStatusesOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getStatuses({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getStatusesQueryKey(options), }); }; export const createStatusQueryKey = (options: Options) => createQueryKey("createStatus", options); /** * Create Status */ export const createStatusOptions = (options: Options) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await createStatus({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: createStatusQueryKey(options), }); }; /** * Create Status */ export const createStatusMutation = ( options?: Partial> ): UseMutationOptions< CreateStatusResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< CreateStatusResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await createStatus({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Delete Status */ export const deleteStatusMutation = ( options?: Partial> ): UseMutationOptions< DeleteStatusResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< DeleteStatusResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await deleteStatus({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; /** * Update Status */ export const updateStatusMutation = ( options?: Partial> ): UseMutationOptions< UpdateStatusResponse2, AxiosError, Options > => { const mutationOptions: UseMutationOptions< UpdateStatusResponse2, AxiosError, Options > = { mutationFn: async localOptions => { const { data } = await updateStatus({ ...options, ...localOptions, throwOnError: true, }); return data; }, }; return mutationOptions; }; export const getStatusHistoryQueryKey = ( options: Options ) => createQueryKey("getStatusHistory", options); /** * Get Status History */ export const getStatusHistoryOptions = ( options: Options ) => { return queryOptions({ queryFn: async ({ queryKey, signal }) => { const { data } = await getStatusHistory({ ...options, ...queryKey[0], signal, throwOnError: true, }); return data; }, queryKey: getStatusHistoryQueryKey(options), }); };