2838 lines
74 KiB
TypeScript
2838 lines
74 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,
|
|
createClient,
|
|
createDeal,
|
|
createDealGroup,
|
|
createDealProduct,
|
|
createDealProductService,
|
|
createDealService,
|
|
createMarketplace,
|
|
createProduct,
|
|
createProject,
|
|
createService,
|
|
createServiceCategory,
|
|
createServicesKit,
|
|
createStatus,
|
|
createTag,
|
|
deleteBarcodeTemplate,
|
|
deleteBoard,
|
|
deleteClient,
|
|
deleteDeal,
|
|
deleteDealGroup,
|
|
deleteDealProduct,
|
|
deleteDealProductService,
|
|
deleteDealService,
|
|
deleteMarketplace,
|
|
deleteProduct,
|
|
deleteProject,
|
|
deleteService,
|
|
deleteServiceCategory,
|
|
deleteServicesKit,
|
|
deleteStatus,
|
|
deleteTag,
|
|
duplicateProductServices,
|
|
getBarcodeTemplateAttributes,
|
|
getBarcodeTemplates,
|
|
getBarcodeTemplateSizes,
|
|
getBaseMarketplaces,
|
|
getBoards,
|
|
getBuiltInModules,
|
|
getClients,
|
|
getDealProducts,
|
|
getDeals,
|
|
getDealServices,
|
|
getDealTagColors,
|
|
getMarketplaces,
|
|
getProductBarcodePdf,
|
|
getProducts,
|
|
getProjects,
|
|
getServiceCategories,
|
|
getServices,
|
|
getServicesKits,
|
|
getStatuses,
|
|
getStatusHistory,
|
|
switchDealTag,
|
|
updateBarcodeTemplate,
|
|
updateBoard,
|
|
updateClient,
|
|
updateDeal,
|
|
updateDealGroup,
|
|
updateDealProduct,
|
|
updateDealProductService,
|
|
updateDealService,
|
|
updateDealsInGroup,
|
|
updateMarketplace,
|
|
updateProduct,
|
|
updateProject,
|
|
updateService,
|
|
updateServiceCategory,
|
|
updateServicesKit,
|
|
updateStatus,
|
|
updateTag,
|
|
type Options,
|
|
} from "../sdk.gen";
|
|
import type {
|
|
AddKitToDealData,
|
|
AddKitToDealError,
|
|
AddKitToDealProductData,
|
|
AddKitToDealProductError,
|
|
AddKitToDealProductResponse,
|
|
AddKitToDealResponse,
|
|
CreateBarcodeTemplateData,
|
|
CreateBarcodeTemplateError,
|
|
CreateBarcodeTemplateResponse2,
|
|
CreateBoardData,
|
|
CreateBoardError,
|
|
CreateBoardResponse2,
|
|
CreateClientData,
|
|
CreateClientError,
|
|
CreateClientResponse2,
|
|
CreateDealData,
|
|
CreateDealError,
|
|
CreateDealGroupData,
|
|
CreateDealGroupError,
|
|
CreateDealGroupResponse2,
|
|
CreateDealProductData,
|
|
CreateDealProductError,
|
|
CreateDealProductResponse2,
|
|
CreateDealProductServiceData,
|
|
CreateDealProductServiceError,
|
|
CreateDealProductServiceResponse,
|
|
CreateDealResponse2,
|
|
CreateDealServiceData,
|
|
CreateDealServiceError,
|
|
CreateDealServiceResponse2,
|
|
CreateMarketplaceData,
|
|
CreateMarketplaceError,
|
|
CreateMarketplaceResponse2,
|
|
CreateProductData,
|
|
CreateProductError,
|
|
CreateProductResponse2,
|
|
CreateProjectData,
|
|
CreateProjectError,
|
|
CreateProjectResponse2,
|
|
CreateServiceCategoryData,
|
|
CreateServiceCategoryError,
|
|
CreateServiceCategoryResponse2,
|
|
CreateServiceData,
|
|
CreateServiceError,
|
|
CreateServiceResponse2,
|
|
CreateServicesKitData,
|
|
CreateServicesKitError,
|
|
CreateServicesKitResponse2,
|
|
CreateStatusData,
|
|
CreateStatusError,
|
|
CreateStatusResponse2,
|
|
CreateTagData,
|
|
CreateTagError,
|
|
CreateTagResponse,
|
|
DeleteBarcodeTemplateData,
|
|
DeleteBarcodeTemplateError,
|
|
DeleteBarcodeTemplateResponse2,
|
|
DeleteBoardData,
|
|
DeleteBoardError,
|
|
DeleteBoardResponse2,
|
|
DeleteClientData,
|
|
DeleteClientError,
|
|
DeleteClientResponse2,
|
|
DeleteDealData,
|
|
DeleteDealError,
|
|
DeleteDealGroupData,
|
|
DeleteDealGroupError,
|
|
DeleteDealGroupResponse2,
|
|
DeleteDealProductData,
|
|
DeleteDealProductError,
|
|
DeleteDealProductResponse2,
|
|
DeleteDealProductServiceData,
|
|
DeleteDealProductServiceError,
|
|
DeleteDealProductServiceResponse,
|
|
DeleteDealResponse2,
|
|
DeleteDealServiceData,
|
|
DeleteDealServiceError,
|
|
DeleteDealServiceResponse2,
|
|
DeleteMarketplaceData,
|
|
DeleteMarketplaceError,
|
|
DeleteMarketplaceResponse2,
|
|
DeleteProductData,
|
|
DeleteProductError,
|
|
DeleteProductResponse2,
|
|
DeleteProjectData,
|
|
DeleteProjectError,
|
|
DeleteProjectResponse2,
|
|
DeleteServiceCategoryData,
|
|
DeleteServiceCategoryError,
|
|
DeleteServiceCategoryResponse2,
|
|
DeleteServiceData,
|
|
DeleteServiceError,
|
|
DeleteServiceResponse2,
|
|
DeleteServicesKitData,
|
|
DeleteServicesKitError,
|
|
DeleteServicesKitResponse2,
|
|
DeleteStatusData,
|
|
DeleteStatusError,
|
|
DeleteStatusResponse2,
|
|
DeleteTagData,
|
|
DeleteTagError,
|
|
DeleteTagResponse,
|
|
DuplicateProductServicesData,
|
|
DuplicateProductServicesError,
|
|
DuplicateProductServicesResponse,
|
|
GetBarcodeTemplateAttributesData,
|
|
GetBarcodeTemplatesData,
|
|
GetBarcodeTemplateSizesData,
|
|
GetBaseMarketplacesData,
|
|
GetBoardsData,
|
|
GetBuiltInModulesData,
|
|
GetClientsData,
|
|
GetDealProductsData,
|
|
GetDealsData,
|
|
GetDealsError,
|
|
GetDealServicesData,
|
|
GetDealsResponse2,
|
|
GetDealTagColorsData,
|
|
GetMarketplacesData,
|
|
GetProductBarcodePdfData,
|
|
GetProductBarcodePdfError,
|
|
GetProductBarcodePdfResponse2,
|
|
GetProductsData,
|
|
GetProductsError,
|
|
GetProductsResponse2,
|
|
GetProjectsData,
|
|
GetServiceCategoriesData,
|
|
GetServicesData,
|
|
GetServicesKitsData,
|
|
GetStatusesData,
|
|
GetStatusHistoryData,
|
|
SwitchDealTagData,
|
|
SwitchDealTagError,
|
|
SwitchDealTagResponse2,
|
|
UpdateBarcodeTemplateData,
|
|
UpdateBarcodeTemplateError,
|
|
UpdateBarcodeTemplateResponse2,
|
|
UpdateBoardData,
|
|
UpdateBoardError,
|
|
UpdateBoardResponse2,
|
|
UpdateClientData,
|
|
UpdateClientError,
|
|
UpdateClientResponse2,
|
|
UpdateDealData,
|
|
UpdateDealError,
|
|
UpdateDealGroupData,
|
|
UpdateDealGroupError,
|
|
UpdateDealGroupResponse2,
|
|
UpdateDealProductData,
|
|
UpdateDealProductError,
|
|
UpdateDealProductResponse2,
|
|
UpdateDealProductServiceData,
|
|
UpdateDealProductServiceError,
|
|
UpdateDealProductServiceResponse,
|
|
UpdateDealResponse2,
|
|
UpdateDealServiceData,
|
|
UpdateDealServiceError,
|
|
UpdateDealServiceResponse2,
|
|
UpdateDealsInGroupData,
|
|
UpdateDealsInGroupError,
|
|
UpdateDealsInGroupResponse2,
|
|
UpdateMarketplaceData,
|
|
UpdateMarketplaceError,
|
|
UpdateMarketplaceResponse2,
|
|
UpdateProductData,
|
|
UpdateProductError,
|
|
UpdateProductResponse2,
|
|
UpdateProjectData,
|
|
UpdateProjectError,
|
|
UpdateProjectResponse2,
|
|
UpdateServiceCategoryData,
|
|
UpdateServiceCategoryError,
|
|
UpdateServiceCategoryResponse2,
|
|
UpdateServiceData,
|
|
UpdateServiceError,
|
|
UpdateServiceResponse2,
|
|
UpdateServicesKitData,
|
|
UpdateServicesKitError,
|
|
UpdateServicesKitResponse2,
|
|
UpdateStatusData,
|
|
UpdateStatusError,
|
|
UpdateStatusResponse2,
|
|
UpdateTagData,
|
|
UpdateTagError,
|
|
UpdateTagResponse,
|
|
} 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;
|
|
};
|
|
|
|
/**
|
|
* Delete Group
|
|
*/
|
|
export const deleteDealGroupMutation = (
|
|
options?: Partial<Options<DeleteDealGroupData>>
|
|
): UseMutationOptions<
|
|
DeleteDealGroupResponse2,
|
|
AxiosError<DeleteDealGroupError>,
|
|
Options<DeleteDealGroupData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteDealGroupResponse2,
|
|
AxiosError<DeleteDealGroupError>,
|
|
Options<DeleteDealGroupData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await deleteDealGroup({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Update Group
|
|
*/
|
|
export const updateDealGroupMutation = (
|
|
options?: Partial<Options<UpdateDealGroupData>>
|
|
): UseMutationOptions<
|
|
UpdateDealGroupResponse2,
|
|
AxiosError<UpdateDealGroupError>,
|
|
Options<UpdateDealGroupData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateDealGroupResponse2,
|
|
AxiosError<UpdateDealGroupError>,
|
|
Options<UpdateDealGroupData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await updateDealGroup({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const createDealGroupQueryKey = (
|
|
options: Options<CreateDealGroupData>
|
|
) => createQueryKey("createDealGroup", options);
|
|
|
|
/**
|
|
* Create Group
|
|
*/
|
|
export const createDealGroupOptions = (
|
|
options: Options<CreateDealGroupData>
|
|
) => {
|
|
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<Options<CreateDealGroupData>>
|
|
): UseMutationOptions<
|
|
CreateDealGroupResponse2,
|
|
AxiosError<CreateDealGroupError>,
|
|
Options<CreateDealGroupData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateDealGroupResponse2,
|
|
AxiosError<CreateDealGroupError>,
|
|
Options<CreateDealGroupData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await createDealGroup({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const updateDealsInGroupQueryKey = (
|
|
options: Options<UpdateDealsInGroupData>
|
|
) => createQueryKey("updateDealsInGroup", options);
|
|
|
|
/**
|
|
* Update Deals In Group
|
|
*/
|
|
export const updateDealsInGroupOptions = (
|
|
options: Options<UpdateDealsInGroupData>
|
|
) => {
|
|
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<Options<UpdateDealsInGroupData>>
|
|
): UseMutationOptions<
|
|
UpdateDealsInGroupResponse2,
|
|
AxiosError<UpdateDealsInGroupError>,
|
|
Options<UpdateDealsInGroupData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateDealsInGroupResponse2,
|
|
AxiosError<UpdateDealsInGroupError>,
|
|
Options<UpdateDealsInGroupData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await updateDealsInGroup({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Update Tag
|
|
*/
|
|
export const updateTagMutation = (
|
|
options?: Partial<Options<UpdateTagData>>
|
|
): UseMutationOptions<
|
|
UpdateTagResponse,
|
|
AxiosError<UpdateTagError>,
|
|
Options<UpdateTagData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateTagResponse,
|
|
AxiosError<UpdateTagError>,
|
|
Options<UpdateTagData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await updateTag({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const createTagQueryKey = (options: Options<CreateTagData>) =>
|
|
createQueryKey("createTag", options);
|
|
|
|
/**
|
|
* Create Tag
|
|
*/
|
|
export const createTagOptions = (options: Options<CreateTagData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createTag({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createTagQueryKey(options),
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Create Tag
|
|
*/
|
|
export const createTagMutation = (
|
|
options?: Partial<Options<CreateTagData>>
|
|
): UseMutationOptions<
|
|
CreateTagResponse,
|
|
AxiosError<CreateTagError>,
|
|
Options<CreateTagData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateTagResponse,
|
|
AxiosError<CreateTagError>,
|
|
Options<CreateTagData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await createTag({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Delete Tag
|
|
*/
|
|
export const deleteTagMutation = (
|
|
options?: Partial<Options<DeleteTagData>>
|
|
): UseMutationOptions<
|
|
DeleteTagResponse,
|
|
AxiosError<DeleteTagError>,
|
|
Options<DeleteTagData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteTagResponse,
|
|
AxiosError<DeleteTagError>,
|
|
Options<DeleteTagData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await deleteTag({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const switchDealTagQueryKey = (options: Options<SwitchDealTagData>) =>
|
|
createQueryKey("switchDealTag", options);
|
|
|
|
/**
|
|
* Switch Deal Tag
|
|
*/
|
|
export const switchDealTagOptions = (options: Options<SwitchDealTagData>) => {
|
|
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<Options<SwitchDealTagData>>
|
|
): UseMutationOptions<
|
|
SwitchDealTagResponse2,
|
|
AxiosError<SwitchDealTagError>,
|
|
Options<SwitchDealTagData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
SwitchDealTagResponse2,
|
|
AxiosError<SwitchDealTagError>,
|
|
Options<SwitchDealTagData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await switchDealTag({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getDealTagColorsQueryKey = (
|
|
options?: Options<GetDealTagColorsData>
|
|
) => createQueryKey("getDealTagColors", options);
|
|
|
|
/**
|
|
* Get Deal Tag Colors
|
|
*/
|
|
export const getDealTagColorsOptions = (
|
|
options?: Options<GetDealTagColorsData>
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getDealTagColors({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getDealTagColorsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
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 getClientsQueryKey = (options?: Options<GetClientsData>) =>
|
|
createQueryKey("getClients", options);
|
|
|
|
/**
|
|
* Get Clients
|
|
*/
|
|
export const getClientsOptions = (options?: Options<GetClientsData>) => {
|
|
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<CreateClientData>) =>
|
|
createQueryKey("createClient", options);
|
|
|
|
/**
|
|
* Create Client
|
|
*/
|
|
export const createClientOptions = (options: Options<CreateClientData>) => {
|
|
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<Options<CreateClientData>>
|
|
): UseMutationOptions<
|
|
CreateClientResponse2,
|
|
AxiosError<CreateClientError>,
|
|
Options<CreateClientData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateClientResponse2,
|
|
AxiosError<CreateClientError>,
|
|
Options<CreateClientData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await createClient({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Delete Product
|
|
*/
|
|
export const deleteClientMutation = (
|
|
options?: Partial<Options<DeleteClientData>>
|
|
): UseMutationOptions<
|
|
DeleteClientResponse2,
|
|
AxiosError<DeleteClientError>,
|
|
Options<DeleteClientData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteClientResponse2,
|
|
AxiosError<DeleteClientError>,
|
|
Options<DeleteClientData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await deleteClient({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Update Client
|
|
*/
|
|
export const updateClientMutation = (
|
|
options?: Partial<Options<UpdateClientData>>
|
|
): UseMutationOptions<
|
|
UpdateClientResponse2,
|
|
AxiosError<UpdateClientError>,
|
|
Options<UpdateClientData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateClientResponse2,
|
|
AxiosError<UpdateClientError>,
|
|
Options<UpdateClientData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await updateClient({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
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 getBaseMarketplacesQueryKey = (
|
|
options?: Options<GetBaseMarketplacesData>
|
|
) => createQueryKey("getBaseMarketplaces", options);
|
|
|
|
/**
|
|
* Get Base Marketplaces
|
|
*/
|
|
export const getBaseMarketplacesOptions = (
|
|
options?: Options<GetBaseMarketplacesData>
|
|
) => {
|
|
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<GetMarketplacesData>
|
|
) => createQueryKey("getMarketplaces", options);
|
|
|
|
/**
|
|
* Get Marketplaces
|
|
*/
|
|
export const getMarketplacesOptions = (
|
|
options: Options<GetMarketplacesData>
|
|
) => {
|
|
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<CreateMarketplaceData>
|
|
) => createQueryKey("createMarketplace", options);
|
|
|
|
/**
|
|
* Create Product
|
|
*/
|
|
export const createMarketplaceOptions = (
|
|
options: Options<CreateMarketplaceData>
|
|
) => {
|
|
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<Options<CreateMarketplaceData>>
|
|
): UseMutationOptions<
|
|
CreateMarketplaceResponse2,
|
|
AxiosError<CreateMarketplaceError>,
|
|
Options<CreateMarketplaceData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateMarketplaceResponse2,
|
|
AxiosError<CreateMarketplaceError>,
|
|
Options<CreateMarketplaceData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await createMarketplace({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Delete Marketplace
|
|
*/
|
|
export const deleteMarketplaceMutation = (
|
|
options?: Partial<Options<DeleteMarketplaceData>>
|
|
): UseMutationOptions<
|
|
DeleteMarketplaceResponse2,
|
|
AxiosError<DeleteMarketplaceError>,
|
|
Options<DeleteMarketplaceData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteMarketplaceResponse2,
|
|
AxiosError<DeleteMarketplaceError>,
|
|
Options<DeleteMarketplaceData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await deleteMarketplace({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Update Marketplace
|
|
*/
|
|
export const updateMarketplaceMutation = (
|
|
options?: Partial<Options<UpdateMarketplaceData>>
|
|
): UseMutationOptions<
|
|
UpdateMarketplaceResponse2,
|
|
AxiosError<UpdateMarketplaceError>,
|
|
Options<UpdateMarketplaceData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateMarketplaceResponse2,
|
|
AxiosError<UpdateMarketplaceError>,
|
|
Options<UpdateMarketplaceData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await updateMarketplace({
|
|
...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 getProductBarcodePdfQueryKey = (
|
|
options: Options<GetProductBarcodePdfData>
|
|
) => createQueryKey("getProductBarcodePdf", options);
|
|
|
|
/**
|
|
* Get Product Barcode Pdf
|
|
*/
|
|
export const getProductBarcodePdfOptions = (
|
|
options: Options<GetProductBarcodePdfData>
|
|
) => {
|
|
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<Options<GetProductBarcodePdfData>>
|
|
): UseMutationOptions<
|
|
GetProductBarcodePdfResponse2,
|
|
AxiosError<GetProductBarcodePdfError>,
|
|
Options<GetProductBarcodePdfData>
|
|
> => {
|
|
const mutationOptions: UseMutationOptions<
|
|
GetProductBarcodePdfResponse2,
|
|
AxiosError<GetProductBarcodePdfError>,
|
|
Options<GetProductBarcodePdfData>
|
|
> = {
|
|
mutationFn: async localOptions => {
|
|
const { data } = await getProductBarcodePdf({
|
|
...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;
|
|
};
|
|
|
|
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),
|
|
});
|
|
};
|