1343 lines
52 KiB
TypeScript
1343 lines
52 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import { type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
|
import type { AxiosError } from 'axios';
|
|
|
|
import { client } from '../client.gen';
|
|
import { addKitToDeal, addKitToDealProduct, createBarcodeTemplate, createBoard, createClient, createDeal, createDealGroup, createDealProduct, createDealProductService, createDealService, createMarketplace, createProduct, createProject, createService, createServiceCategory, createServicesKit, createStatus, deleteBarcodeTemplate, deleteBoard, deleteClient, deleteDeal, deleteDealGroup, deleteDealProduct, deleteDealProductService, deleteDealService, deleteMarketplace, deleteProduct, deleteProject, deleteService, deleteServiceCategory, deleteServicesKit, deleteStatus, duplicateProductServices, getBarcodeTemplateAttributes, getBarcodeTemplates, getBarcodeTemplateSizes, getBaseMarketplaces, getBoards, getBuiltInModules, getClients, getDealProducts, getDeals, getDealServices, getMarketplaces, getProductBarcodePdf, getProducts, getProjects, getServiceCategories, getServices, getServicesKits, getStatuses, getStatusHistory, type Options, updateBarcodeTemplate, updateBoard, updateClient, updateDeal, updateDealGroup, updateDealProduct, updateDealProductService, updateDealService, updateDealsInGroup, updateMarketplace, updateProduct, updateProject, updateService, updateServiceCategory, updateServicesKit, updateStatus } 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, 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, DuplicateProductServicesData, DuplicateProductServicesError, DuplicateProductServicesResponse, GetBarcodeTemplateAttributesData, GetBarcodeTemplatesData, GetBarcodeTemplateSizesData, GetBaseMarketplacesData, GetBoardsData, GetBuiltInModulesData, GetClientsData, GetDealProductsData, GetDealsData, GetDealsError, GetDealServicesData, GetDealsResponse2, GetMarketplacesData, GetProductBarcodePdfData, GetProductBarcodePdfError, GetProductBarcodePdfResponse2, GetProductsData, GetProductsError, GetProductsResponse2, GetProjectsData, GetServiceCategoriesData, GetServicesData, GetServicesKitsData, GetStatusesData, GetStatusHistoryData, 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 } from '../types.gen';
|
|
|
|
export type QueryKey<TOptions extends Options> = [
|
|
Pick<TOptions, 'baseURL' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
_id: string;
|
|
_infinite?: boolean;
|
|
tags?: ReadonlyArray<string>;
|
|
}
|
|
];
|
|
|
|
const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, infinite?: boolean, tags?: ReadonlyArray<string>): [
|
|
QueryKey<TOptions>[0]
|
|
] => {
|
|
const params: QueryKey<TOptions>[0] = { _id: id, baseURL: options?.baseURL || (options?.client ?? client).getConfig().baseURL } as QueryKey<TOptions>[0];
|
|
if (infinite) {
|
|
params._infinite = infinite;
|
|
}
|
|
if (tags) {
|
|
params.tags = tags;
|
|
}
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createBoard({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteBoard({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateBoard({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createDeal({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteDeal({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateDeal({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteDealGroup({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateDealGroup({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createDealGroup({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await updateDealsInGroup({
|
|
...options,
|
|
...fnOptions,
|
|
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 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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createClient({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteClient({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateClient({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createBarcodeTemplate({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteBarcodeTemplate({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateBarcodeTemplate({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createDealProduct({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteDealProduct({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateDealProduct({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createDealProductService({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteDealProductService({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateDealProductService({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await duplicateProductServices({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await addKitToDealProduct({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createDealService({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteDealService({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateDealService({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await addKitToDeal({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createMarketplace({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteMarketplace({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateMarketplace({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createProduct({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteProduct({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateProduct({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await getProductBarcodePdf({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createService({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteService({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateService({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createServiceCategory({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteServiceCategory({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateServiceCategory({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createServicesKit({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteServicesKit({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateServicesKit({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createProject({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteProject({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateProject({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 (fnOptions) => {
|
|
const { data } = await createStatus({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await deleteStatus({
|
|
...options,
|
|
...fnOptions,
|
|
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 (fnOptions) => {
|
|
const { data } = await updateStatus({
|
|
...options,
|
|
...fnOptions,
|
|
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)
|
|
});
|
|
};
|