Files
Crm-Frontend/src/lib/client/@tanstack/react-query.gen.ts

2113 lines
55 KiB
TypeScript

// This file is auto-generated by @hey-api/openapi-ts
import {
infiniteQueryOptions,
queryOptions,
type InfiniteData,
type UseMutationOptions,
} from "@tanstack/react-query";
import type { AxiosError } from "axios";
import { client as _heyApiClient } from "../client.gen";
import {
addKitToDeal,
addKitToDealProduct,
createBarcodeTemplate,
createBoard,
createDeal,
createDealProduct,
createDealProductService,
createDealService,
createProduct,
createProject,
createService,
createServiceCategory,
createServicesKit,
createStatus,
deleteBarcodeTemplate,
deleteBoard,
deleteDeal,
deleteDealProduct,
deleteDealProductService,
deleteDealService,
deleteProduct,
deleteProject,
deleteService,
deleteServiceCategory,
deleteServicesKit,
deleteStatus,
duplicateProductServices,
getBarcodeTemplateAttributes,
getBarcodeTemplates,
getBarcodeTemplateSizes,
getBoards,
getBuiltInModules,
getDealProducts,
getDeals,
getDealServices,
getProducts,
getProjects,
getServiceCategories,
getServices,
getServicesKits,
getStatuses,
getStatusHistory,
updateBarcodeTemplate,
updateBoard,
updateDeal,
updateDealProduct,
updateDealProductService,
updateDealService,
updateProduct,
updateProject,
updateService,
updateServiceCategory,
updateServicesKit,
updateStatus,
type Options,
} from "../sdk.gen";
import type {
AddKitToDealData,
AddKitToDealError,
AddKitToDealProductData,
AddKitToDealProductError,
AddKitToDealProductResponse,
AddKitToDealResponse,
CreateBarcodeTemplateData,
CreateBarcodeTemplateError,
CreateBarcodeTemplateResponse2,
CreateBoardData,
CreateBoardError,
CreateBoardResponse2,
CreateDealData,
CreateDealError,
CreateDealProductData,
CreateDealProductError,
CreateDealProductResponse2,
CreateDealProductServiceData,
CreateDealProductServiceError,
CreateDealProductServiceResponse,
CreateDealResponse2,
CreateDealServiceData,
CreateDealServiceError,
CreateDealServiceResponse2,
CreateProductData,
CreateProductError,
CreateProductResponse2,
CreateProjectData,
CreateProjectError,
CreateProjectResponse2,
CreateServiceCategoryData,
CreateServiceCategoryError,
CreateServiceCategoryResponse2,
CreateServiceData,
CreateServiceError,
CreateServiceResponse2,
CreateServicesKitData,
CreateServicesKitError,
CreateServicesKitResponse2,
CreateStatusData,
CreateStatusError,
CreateStatusResponse2,
DeleteBarcodeTemplateData,
DeleteBarcodeTemplateError,
DeleteBarcodeTemplateResponse2,
DeleteBoardData,
DeleteBoardError,
DeleteBoardResponse2,
DeleteDealData,
DeleteDealError,
DeleteDealProductData,
DeleteDealProductError,
DeleteDealProductResponse2,
DeleteDealProductServiceData,
DeleteDealProductServiceError,
DeleteDealProductServiceResponse,
DeleteDealResponse2,
DeleteDealServiceData,
DeleteDealServiceError,
DeleteDealServiceResponse2,
DeleteProductData,
DeleteProductError,
DeleteProductResponse2,
DeleteProjectData,
DeleteProjectError,
DeleteProjectResponse2,
DeleteServiceCategoryData,
DeleteServiceCategoryError,
DeleteServiceCategoryResponse2,
DeleteServiceData,
DeleteServiceError,
DeleteServiceResponse2,
DeleteServicesKitData,
DeleteServicesKitError,
DeleteServicesKitResponse2,
DeleteStatusData,
DeleteStatusError,
DeleteStatusResponse2,
DuplicateProductServicesData,
DuplicateProductServicesError,
DuplicateProductServicesResponse,
GetBarcodeTemplateAttributesData,
GetBarcodeTemplatesData,
GetBarcodeTemplateSizesData,
GetBoardsData,
GetBuiltInModulesData,
GetDealProductsData,
GetDealsData,
GetDealsError,
GetDealServicesData,
GetDealsResponse2,
GetProductsData,
GetProductsError,
GetProductsResponse2,
GetProjectsData,
GetServiceCategoriesData,
GetServicesData,
GetServicesKitsData,
GetStatusesData,
GetStatusHistoryData,
UpdateBarcodeTemplateData,
UpdateBarcodeTemplateError,
UpdateBarcodeTemplateResponse2,
UpdateBoardData,
UpdateBoardError,
UpdateBoardResponse2,
UpdateDealData,
UpdateDealError,
UpdateDealProductData,
UpdateDealProductError,
UpdateDealProductResponse2,
UpdateDealProductServiceData,
UpdateDealProductServiceError,
UpdateDealProductServiceResponse,
UpdateDealResponse2,
UpdateDealServiceData,
UpdateDealServiceError,
UpdateDealServiceResponse2,
UpdateProductData,
UpdateProductError,
UpdateProductResponse2,
UpdateProjectData,
UpdateProjectError,
UpdateProjectResponse2,
UpdateServiceCategoryData,
UpdateServiceCategoryError,
UpdateServiceCategoryResponse2,
UpdateServiceData,
UpdateServiceError,
UpdateServiceResponse2,
UpdateServicesKitData,
UpdateServicesKitError,
UpdateServicesKitResponse2,
UpdateStatusData,
UpdateStatusError,
UpdateStatusResponse2,
} from "../types.gen";
export type QueryKey<TOptions extends Options> = [
Pick<TOptions, "baseURL" | "body" | "headers" | "path" | "query"> & {
_id: string;
_infinite?: boolean;
},
];
const createQueryKey = <TOptions extends Options>(
id: string,
options?: TOptions,
infinite?: boolean
): [QueryKey<TOptions>[0]] => {
const params: QueryKey<TOptions>[0] = {
_id: id,
baseURL:
options?.baseURL ||
(options?.client ?? _heyApiClient).getConfig().baseURL,
} as QueryKey<TOptions>[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 getBoardsQueryKey = (options: Options<GetBoardsData>) =>
createQueryKey("getBoards", options);
/**
* Get Boards
*/
export const getBoardsOptions = (options: Options<GetBoardsData>) => {
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<CreateBoardData>) =>
createQueryKey("createBoard", options);
/**
* Create Board
*/
export const createBoardOptions = (options: Options<CreateBoardData>) => {
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<Options<CreateBoardData>>
): UseMutationOptions<
CreateBoardResponse2,
AxiosError<CreateBoardError>,
Options<CreateBoardData>
> => {
const mutationOptions: UseMutationOptions<
CreateBoardResponse2,
AxiosError<CreateBoardError>,
Options<CreateBoardData>
> = {
mutationFn: async localOptions => {
const { data } = await createBoard({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Board
*/
export const deleteBoardMutation = (
options?: Partial<Options<DeleteBoardData>>
): UseMutationOptions<
DeleteBoardResponse2,
AxiosError<DeleteBoardError>,
Options<DeleteBoardData>
> => {
const mutationOptions: UseMutationOptions<
DeleteBoardResponse2,
AxiosError<DeleteBoardError>,
Options<DeleteBoardData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteBoard({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Board
*/
export const updateBoardMutation = (
options?: Partial<Options<UpdateBoardData>>
): UseMutationOptions<
UpdateBoardResponse2,
AxiosError<UpdateBoardError>,
Options<UpdateBoardData>
> => {
const mutationOptions: UseMutationOptions<
UpdateBoardResponse2,
AxiosError<UpdateBoardError>,
Options<UpdateBoardData>
> = {
mutationFn: async localOptions => {
const { data } = await updateBoard({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getDealsQueryKey = (options?: Options<GetDealsData>) =>
createQueryKey("getDeals", options);
/**
* Get Deals
*/
export const getDealsOptions = (options?: Options<GetDealsData>) => {
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<QueryKey<Options>[0], "body" | "headers" | "path" | "query">,
>(
queryKey: QueryKey<Options>,
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<GetDealsData>
): QueryKey<Options<GetDealsData>> => createQueryKey("getDeals", options, true);
/**
* Get Deals
*/
export const getDealsInfiniteOptions = (options?: Options<GetDealsData>) => {
return infiniteQueryOptions<
GetDealsResponse2,
AxiosError<GetDealsError>,
InfiniteData<GetDealsResponse2>,
QueryKey<Options<GetDealsData>>,
| number
| null
| Pick<
QueryKey<Options<GetDealsData>>[0],
"body" | "headers" | "path" | "query"
>
>(
// @ts-ignore
{
queryFn: async ({ pageParam, queryKey, signal }) => {
// @ts-ignore
const page: Pick<
QueryKey<Options<GetDealsData>>[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<CreateDealData>) =>
createQueryKey("createDeal", options);
/**
* Create Deal
*/
export const createDealOptions = (options: Options<CreateDealData>) => {
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<Options<CreateDealData>>
): UseMutationOptions<
CreateDealResponse2,
AxiosError<CreateDealError>,
Options<CreateDealData>
> => {
const mutationOptions: UseMutationOptions<
CreateDealResponse2,
AxiosError<CreateDealError>,
Options<CreateDealData>
> = {
mutationFn: async localOptions => {
const { data } = await createDeal({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Deal
*/
export const deleteDealMutation = (
options?: Partial<Options<DeleteDealData>>
): UseMutationOptions<
DeleteDealResponse2,
AxiosError<DeleteDealError>,
Options<DeleteDealData>
> => {
const mutationOptions: UseMutationOptions<
DeleteDealResponse2,
AxiosError<DeleteDealError>,
Options<DeleteDealData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteDeal({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Deal
*/
export const updateDealMutation = (
options?: Partial<Options<UpdateDealData>>
): UseMutationOptions<
UpdateDealResponse2,
AxiosError<UpdateDealError>,
Options<UpdateDealData>
> => {
const mutationOptions: UseMutationOptions<
UpdateDealResponse2,
AxiosError<UpdateDealError>,
Options<UpdateDealData>
> = {
mutationFn: async localOptions => {
const { data } = await updateDeal({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getBuiltInModulesQueryKey = (
options?: Options<GetBuiltInModulesData>
) => createQueryKey("getBuiltInModules", options);
/**
* Get Built In Modules
*/
export const getBuiltInModulesOptions = (
options?: Options<GetBuiltInModulesData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getBuiltInModules({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getBuiltInModulesQueryKey(options),
});
};
export const getProjectsQueryKey = (options?: Options<GetProjectsData>) =>
createQueryKey("getProjects", options);
/**
* Get Projects
*/
export const getProjectsOptions = (options?: Options<GetProjectsData>) => {
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<CreateProjectData>) =>
createQueryKey("createProject", options);
/**
* Create Project
*/
export const createProjectOptions = (options: Options<CreateProjectData>) => {
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<Options<CreateProjectData>>
): UseMutationOptions<
CreateProjectResponse2,
AxiosError<CreateProjectError>,
Options<CreateProjectData>
> => {
const mutationOptions: UseMutationOptions<
CreateProjectResponse2,
AxiosError<CreateProjectError>,
Options<CreateProjectData>
> = {
mutationFn: async localOptions => {
const { data } = await createProject({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Project
*/
export const deleteProjectMutation = (
options?: Partial<Options<DeleteProjectData>>
): UseMutationOptions<
DeleteProjectResponse2,
AxiosError<DeleteProjectError>,
Options<DeleteProjectData>
> => {
const mutationOptions: UseMutationOptions<
DeleteProjectResponse2,
AxiosError<DeleteProjectError>,
Options<DeleteProjectData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteProject({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Project
*/
export const updateProjectMutation = (
options?: Partial<Options<UpdateProjectData>>
): UseMutationOptions<
UpdateProjectResponse2,
AxiosError<UpdateProjectError>,
Options<UpdateProjectData>
> => {
const mutationOptions: UseMutationOptions<
UpdateProjectResponse2,
AxiosError<UpdateProjectError>,
Options<UpdateProjectData>
> = {
mutationFn: async localOptions => {
const { data } = await updateProject({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getStatusesQueryKey = (options: Options<GetStatusesData>) =>
createQueryKey("getStatuses", options);
/**
* Get Statuses
*/
export const getStatusesOptions = (options: Options<GetStatusesData>) => {
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<CreateStatusData>) =>
createQueryKey("createStatus", options);
/**
* Create Status
*/
export const createStatusOptions = (options: Options<CreateStatusData>) => {
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<Options<CreateStatusData>>
): UseMutationOptions<
CreateStatusResponse2,
AxiosError<CreateStatusError>,
Options<CreateStatusData>
> => {
const mutationOptions: UseMutationOptions<
CreateStatusResponse2,
AxiosError<CreateStatusError>,
Options<CreateStatusData>
> = {
mutationFn: async localOptions => {
const { data } = await createStatus({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Status
*/
export const deleteStatusMutation = (
options?: Partial<Options<DeleteStatusData>>
): UseMutationOptions<
DeleteStatusResponse2,
AxiosError<DeleteStatusError>,
Options<DeleteStatusData>
> => {
const mutationOptions: UseMutationOptions<
DeleteStatusResponse2,
AxiosError<DeleteStatusError>,
Options<DeleteStatusData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteStatus({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Status
*/
export const updateStatusMutation = (
options?: Partial<Options<UpdateStatusData>>
): UseMutationOptions<
UpdateStatusResponse2,
AxiosError<UpdateStatusError>,
Options<UpdateStatusData>
> => {
const mutationOptions: UseMutationOptions<
UpdateStatusResponse2,
AxiosError<UpdateStatusError>,
Options<UpdateStatusData>
> = {
mutationFn: async localOptions => {
const { data } = await updateStatus({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getStatusHistoryQueryKey = (
options: Options<GetStatusHistoryData>
) => createQueryKey("getStatusHistory", options);
/**
* Get Status History
*/
export const getStatusHistoryOptions = (
options: Options<GetStatusHistoryData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getStatusHistory({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getStatusHistoryQueryKey(options),
});
};
export const getBarcodeTemplatesQueryKey = (
options?: Options<GetBarcodeTemplatesData>
) => createQueryKey("getBarcodeTemplates", options);
/**
* Get Barcode Templates
*/
export const getBarcodeTemplatesOptions = (
options?: Options<GetBarcodeTemplatesData>
) => {
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<CreateBarcodeTemplateData>
) => createQueryKey("createBarcodeTemplate", options);
/**
* Create Barcode Template
*/
export const createBarcodeTemplateOptions = (
options: Options<CreateBarcodeTemplateData>
) => {
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<Options<CreateBarcodeTemplateData>>
): UseMutationOptions<
CreateBarcodeTemplateResponse2,
AxiosError<CreateBarcodeTemplateError>,
Options<CreateBarcodeTemplateData>
> => {
const mutationOptions: UseMutationOptions<
CreateBarcodeTemplateResponse2,
AxiosError<CreateBarcodeTemplateError>,
Options<CreateBarcodeTemplateData>
> = {
mutationFn: async localOptions => {
const { data } = await createBarcodeTemplate({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Barcode Template
*/
export const deleteBarcodeTemplateMutation = (
options?: Partial<Options<DeleteBarcodeTemplateData>>
): UseMutationOptions<
DeleteBarcodeTemplateResponse2,
AxiosError<DeleteBarcodeTemplateError>,
Options<DeleteBarcodeTemplateData>
> => {
const mutationOptions: UseMutationOptions<
DeleteBarcodeTemplateResponse2,
AxiosError<DeleteBarcodeTemplateError>,
Options<DeleteBarcodeTemplateData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteBarcodeTemplate({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Barcode Template
*/
export const updateBarcodeTemplateMutation = (
options?: Partial<Options<UpdateBarcodeTemplateData>>
): UseMutationOptions<
UpdateBarcodeTemplateResponse2,
AxiosError<UpdateBarcodeTemplateError>,
Options<UpdateBarcodeTemplateData>
> => {
const mutationOptions: UseMutationOptions<
UpdateBarcodeTemplateResponse2,
AxiosError<UpdateBarcodeTemplateError>,
Options<UpdateBarcodeTemplateData>
> = {
mutationFn: async localOptions => {
const { data } = await updateBarcodeTemplate({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getBarcodeTemplateAttributesQueryKey = (
options?: Options<GetBarcodeTemplateAttributesData>
) => createQueryKey("getBarcodeTemplateAttributes", options);
/**
* Get Barcode Template Attributes
*/
export const getBarcodeTemplateAttributesOptions = (
options?: Options<GetBarcodeTemplateAttributesData>
) => {
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<GetBarcodeTemplateSizesData>
) => createQueryKey("getBarcodeTemplateSizes", options);
/**
* Get Barcode Template Sizes
*/
export const getBarcodeTemplateSizesOptions = (
options?: Options<GetBarcodeTemplateSizesData>
) => {
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<GetDealProductsData>
) => createQueryKey("getDealProducts", options);
/**
* Get Deal Products
*/
export const getDealProductsOptions = (
options: Options<GetDealProductsData>
) => {
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<CreateDealProductData>
) => createQueryKey("createDealProduct", options);
/**
* Create Deal Product
*/
export const createDealProductOptions = (
options: Options<CreateDealProductData>
) => {
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<Options<CreateDealProductData>>
): UseMutationOptions<
CreateDealProductResponse2,
AxiosError<CreateDealProductError>,
Options<CreateDealProductData>
> => {
const mutationOptions: UseMutationOptions<
CreateDealProductResponse2,
AxiosError<CreateDealProductError>,
Options<CreateDealProductData>
> = {
mutationFn: async localOptions => {
const { data } = await createDealProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Deal Product
*/
export const deleteDealProductMutation = (
options?: Partial<Options<DeleteDealProductData>>
): UseMutationOptions<
DeleteDealProductResponse2,
AxiosError<DeleteDealProductError>,
Options<DeleteDealProductData>
> => {
const mutationOptions: UseMutationOptions<
DeleteDealProductResponse2,
AxiosError<DeleteDealProductError>,
Options<DeleteDealProductData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteDealProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Deal Product
*/
export const updateDealProductMutation = (
options?: Partial<Options<UpdateDealProductData>>
): UseMutationOptions<
UpdateDealProductResponse2,
AxiosError<UpdateDealProductError>,
Options<UpdateDealProductData>
> => {
const mutationOptions: UseMutationOptions<
UpdateDealProductResponse2,
AxiosError<UpdateDealProductError>,
Options<UpdateDealProductData>
> = {
mutationFn: async localOptions => {
const { data } = await updateDealProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const createDealProductServiceQueryKey = (
options: Options<CreateDealProductServiceData>
) => createQueryKey("createDealProductService", options);
/**
* Create Deal Product Service
*/
export const createDealProductServiceOptions = (
options: Options<CreateDealProductServiceData>
) => {
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<Options<CreateDealProductServiceData>>
): UseMutationOptions<
CreateDealProductServiceResponse,
AxiosError<CreateDealProductServiceError>,
Options<CreateDealProductServiceData>
> => {
const mutationOptions: UseMutationOptions<
CreateDealProductServiceResponse,
AxiosError<CreateDealProductServiceError>,
Options<CreateDealProductServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await createDealProductService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Deal Product Service
*/
export const deleteDealProductServiceMutation = (
options?: Partial<Options<DeleteDealProductServiceData>>
): UseMutationOptions<
DeleteDealProductServiceResponse,
AxiosError<DeleteDealProductServiceError>,
Options<DeleteDealProductServiceData>
> => {
const mutationOptions: UseMutationOptions<
DeleteDealProductServiceResponse,
AxiosError<DeleteDealProductServiceError>,
Options<DeleteDealProductServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteDealProductService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Deal Product Service
*/
export const updateDealProductServiceMutation = (
options?: Partial<Options<UpdateDealProductServiceData>>
): UseMutationOptions<
UpdateDealProductServiceResponse,
AxiosError<UpdateDealProductServiceError>,
Options<UpdateDealProductServiceData>
> => {
const mutationOptions: UseMutationOptions<
UpdateDealProductServiceResponse,
AxiosError<UpdateDealProductServiceError>,
Options<UpdateDealProductServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await updateDealProductService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const duplicateProductServicesQueryKey = (
options: Options<DuplicateProductServicesData>
) => createQueryKey("duplicateProductServices", options);
/**
* Copy Product Services
*/
export const duplicateProductServicesOptions = (
options: Options<DuplicateProductServicesData>
) => {
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<Options<DuplicateProductServicesData>>
): UseMutationOptions<
DuplicateProductServicesResponse,
AxiosError<DuplicateProductServicesError>,
Options<DuplicateProductServicesData>
> => {
const mutationOptions: UseMutationOptions<
DuplicateProductServicesResponse,
AxiosError<DuplicateProductServicesError>,
Options<DuplicateProductServicesData>
> = {
mutationFn: async localOptions => {
const { data } = await duplicateProductServices({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const addKitToDealProductQueryKey = (
options: Options<AddKitToDealProductData>
) => createQueryKey("addKitToDealProduct", options);
/**
* Add Kit To Deal Product
*/
export const addKitToDealProductOptions = (
options: Options<AddKitToDealProductData>
) => {
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<Options<AddKitToDealProductData>>
): UseMutationOptions<
AddKitToDealProductResponse,
AxiosError<AddKitToDealProductError>,
Options<AddKitToDealProductData>
> => {
const mutationOptions: UseMutationOptions<
AddKitToDealProductResponse,
AxiosError<AddKitToDealProductError>,
Options<AddKitToDealProductData>
> = {
mutationFn: async localOptions => {
const { data } = await addKitToDealProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getDealServicesQueryKey = (
options: Options<GetDealServicesData>
) => createQueryKey("getDealServices", options);
/**
* Get Deal Services
*/
export const getDealServicesOptions = (
options: Options<GetDealServicesData>
) => {
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<CreateDealServiceData>
) => createQueryKey("createDealService", options);
/**
* Create Deal Service
*/
export const createDealServiceOptions = (
options: Options<CreateDealServiceData>
) => {
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<Options<CreateDealServiceData>>
): UseMutationOptions<
CreateDealServiceResponse2,
AxiosError<CreateDealServiceError>,
Options<CreateDealServiceData>
> => {
const mutationOptions: UseMutationOptions<
CreateDealServiceResponse2,
AxiosError<CreateDealServiceError>,
Options<CreateDealServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await createDealService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Deal Service
*/
export const deleteDealServiceMutation = (
options?: Partial<Options<DeleteDealServiceData>>
): UseMutationOptions<
DeleteDealServiceResponse2,
AxiosError<DeleteDealServiceError>,
Options<DeleteDealServiceData>
> => {
const mutationOptions: UseMutationOptions<
DeleteDealServiceResponse2,
AxiosError<DeleteDealServiceError>,
Options<DeleteDealServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteDealService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Deal Service
*/
export const updateDealServiceMutation = (
options?: Partial<Options<UpdateDealServiceData>>
): UseMutationOptions<
UpdateDealServiceResponse2,
AxiosError<UpdateDealServiceError>,
Options<UpdateDealServiceData>
> => {
const mutationOptions: UseMutationOptions<
UpdateDealServiceResponse2,
AxiosError<UpdateDealServiceError>,
Options<UpdateDealServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await updateDealService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const addKitToDealQueryKey = (options: Options<AddKitToDealData>) =>
createQueryKey("addKitToDeal", options);
/**
* Add Kit To Deal
*/
export const addKitToDealOptions = (options: Options<AddKitToDealData>) => {
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<Options<AddKitToDealData>>
): UseMutationOptions<
AddKitToDealResponse,
AxiosError<AddKitToDealError>,
Options<AddKitToDealData>
> => {
const mutationOptions: UseMutationOptions<
AddKitToDealResponse,
AxiosError<AddKitToDealError>,
Options<AddKitToDealData>
> = {
mutationFn: async localOptions => {
const { data } = await addKitToDeal({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
createQueryKey("getProducts", options);
/**
* Get Products
*/
export const getProductsOptions = (options?: Options<GetProductsData>) => {
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<GetProductsData>
): QueryKey<Options<GetProductsData>> =>
createQueryKey("getProducts", options, true);
/**
* Get Products
*/
export const getProductsInfiniteOptions = (
options?: Options<GetProductsData>
) => {
return infiniteQueryOptions<
GetProductsResponse2,
AxiosError<GetProductsError>,
InfiniteData<GetProductsResponse2>,
QueryKey<Options<GetProductsData>>,
| number
| null
| Pick<
QueryKey<Options<GetProductsData>>[0],
"body" | "headers" | "path" | "query"
>
>(
// @ts-ignore
{
queryFn: async ({ pageParam, queryKey, signal }) => {
// @ts-ignore
const page: Pick<
QueryKey<Options<GetProductsData>>[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<CreateProductData>) =>
createQueryKey("createProduct", options);
/**
* Create Product
*/
export const createProductOptions = (options: Options<CreateProductData>) => {
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<Options<CreateProductData>>
): UseMutationOptions<
CreateProductResponse2,
AxiosError<CreateProductError>,
Options<CreateProductData>
> => {
const mutationOptions: UseMutationOptions<
CreateProductResponse2,
AxiosError<CreateProductError>,
Options<CreateProductData>
> = {
mutationFn: async localOptions => {
const { data } = await createProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Product
*/
export const deleteProductMutation = (
options?: Partial<Options<DeleteProductData>>
): UseMutationOptions<
DeleteProductResponse2,
AxiosError<DeleteProductError>,
Options<DeleteProductData>
> => {
const mutationOptions: UseMutationOptions<
DeleteProductResponse2,
AxiosError<DeleteProductError>,
Options<DeleteProductData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Product
*/
export const updateProductMutation = (
options?: Partial<Options<UpdateProductData>>
): UseMutationOptions<
UpdateProductResponse2,
AxiosError<UpdateProductError>,
Options<UpdateProductData>
> => {
const mutationOptions: UseMutationOptions<
UpdateProductResponse2,
AxiosError<UpdateProductError>,
Options<UpdateProductData>
> = {
mutationFn: async localOptions => {
const { data } = await updateProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getServicesQueryKey = (options?: Options<GetServicesData>) =>
createQueryKey("getServices", options);
/**
* Get Services
*/
export const getServicesOptions = (options?: Options<GetServicesData>) => {
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<CreateServiceData>) =>
createQueryKey("createService", options);
/**
* Create Service
*/
export const createServiceOptions = (options: Options<CreateServiceData>) => {
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<Options<CreateServiceData>>
): UseMutationOptions<
CreateServiceResponse2,
AxiosError<CreateServiceError>,
Options<CreateServiceData>
> => {
const mutationOptions: UseMutationOptions<
CreateServiceResponse2,
AxiosError<CreateServiceError>,
Options<CreateServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await createService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Service
*/
export const deleteServiceMutation = (
options?: Partial<Options<DeleteServiceData>>
): UseMutationOptions<
DeleteServiceResponse2,
AxiosError<DeleteServiceError>,
Options<DeleteServiceData>
> => {
const mutationOptions: UseMutationOptions<
DeleteServiceResponse2,
AxiosError<DeleteServiceError>,
Options<DeleteServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Service
*/
export const updateServiceMutation = (
options?: Partial<Options<UpdateServiceData>>
): UseMutationOptions<
UpdateServiceResponse2,
AxiosError<UpdateServiceError>,
Options<UpdateServiceData>
> => {
const mutationOptions: UseMutationOptions<
UpdateServiceResponse2,
AxiosError<UpdateServiceError>,
Options<UpdateServiceData>
> = {
mutationFn: async localOptions => {
const { data } = await updateService({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getServiceCategoriesQueryKey = (
options?: Options<GetServiceCategoriesData>
) => createQueryKey("getServiceCategories", options);
/**
* Get Services Categories
*/
export const getServiceCategoriesOptions = (
options?: Options<GetServiceCategoriesData>
) => {
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<CreateServiceCategoryData>
) => createQueryKey("createServiceCategory", options);
/**
* Create Service Category
*/
export const createServiceCategoryOptions = (
options: Options<CreateServiceCategoryData>
) => {
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<Options<CreateServiceCategoryData>>
): UseMutationOptions<
CreateServiceCategoryResponse2,
AxiosError<CreateServiceCategoryError>,
Options<CreateServiceCategoryData>
> => {
const mutationOptions: UseMutationOptions<
CreateServiceCategoryResponse2,
AxiosError<CreateServiceCategoryError>,
Options<CreateServiceCategoryData>
> = {
mutationFn: async localOptions => {
const { data } = await createServiceCategory({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Service Category
*/
export const deleteServiceCategoryMutation = (
options?: Partial<Options<DeleteServiceCategoryData>>
): UseMutationOptions<
DeleteServiceCategoryResponse2,
AxiosError<DeleteServiceCategoryError>,
Options<DeleteServiceCategoryData>
> => {
const mutationOptions: UseMutationOptions<
DeleteServiceCategoryResponse2,
AxiosError<DeleteServiceCategoryError>,
Options<DeleteServiceCategoryData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteServiceCategory({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Service Category
*/
export const updateServiceCategoryMutation = (
options?: Partial<Options<UpdateServiceCategoryData>>
): UseMutationOptions<
UpdateServiceCategoryResponse2,
AxiosError<UpdateServiceCategoryError>,
Options<UpdateServiceCategoryData>
> => {
const mutationOptions: UseMutationOptions<
UpdateServiceCategoryResponse2,
AxiosError<UpdateServiceCategoryError>,
Options<UpdateServiceCategoryData>
> = {
mutationFn: async localOptions => {
const { data } = await updateServiceCategory({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getServicesKitsQueryKey = (
options?: Options<GetServicesKitsData>
) => createQueryKey("getServicesKits", options);
/**
* Get Services Kits
*/
export const getServicesKitsOptions = (
options?: Options<GetServicesKitsData>
) => {
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<CreateServicesKitData>
) => createQueryKey("createServicesKit", options);
/**
* Create Services Kit
*/
export const createServicesKitOptions = (
options: Options<CreateServicesKitData>
) => {
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<Options<CreateServicesKitData>>
): UseMutationOptions<
CreateServicesKitResponse2,
AxiosError<CreateServicesKitError>,
Options<CreateServicesKitData>
> => {
const mutationOptions: UseMutationOptions<
CreateServicesKitResponse2,
AxiosError<CreateServicesKitError>,
Options<CreateServicesKitData>
> = {
mutationFn: async localOptions => {
const { data } = await createServicesKit({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Services Kit
*/
export const deleteServicesKitMutation = (
options?: Partial<Options<DeleteServicesKitData>>
): UseMutationOptions<
DeleteServicesKitResponse2,
AxiosError<DeleteServicesKitError>,
Options<DeleteServicesKitData>
> => {
const mutationOptions: UseMutationOptions<
DeleteServicesKitResponse2,
AxiosError<DeleteServicesKitError>,
Options<DeleteServicesKitData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteServicesKit({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Update Services Kit
*/
export const updateServicesKitMutation = (
options?: Partial<Options<UpdateServicesKitData>>
): UseMutationOptions<
UpdateServicesKitResponse2,
AxiosError<UpdateServicesKitError>,
Options<UpdateServicesKitData>
> => {
const mutationOptions: UseMutationOptions<
UpdateServicesKitResponse2,
AxiosError<UpdateServicesKitError>,
Options<UpdateServicesKitData>
> = {
mutationFn: async localOptions => {
const { data } = await updateServicesKit({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};