feat: adding services kit to deal
This commit is contained in:
@ -9,6 +9,7 @@ import {
|
||||
import type { AxiosError } from "axios";
|
||||
import { client as _heyApiClient } from "../client.gen";
|
||||
import {
|
||||
addKitToDeal,
|
||||
addKitToDealProduct,
|
||||
createBoard,
|
||||
createDeal,
|
||||
@ -54,9 +55,12 @@ import {
|
||||
type Options,
|
||||
} from "../sdk.gen";
|
||||
import type {
|
||||
AddKitToDealData,
|
||||
AddKitToDealError,
|
||||
AddKitToDealProductData,
|
||||
AddKitToDealProductError,
|
||||
AddKitToDealProductResponse,
|
||||
AddKitToDealResponse,
|
||||
CreateBoardData,
|
||||
CreateBoardError,
|
||||
CreateBoardResponse2,
|
||||
@ -932,57 +936,6 @@ export const updateDealProductMutation = (
|
||||
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 createDealProductServiceQueryKey = (
|
||||
options: Options<CreateDealProductServiceData>
|
||||
) => createQueryKey("createDealProductService", options);
|
||||
@ -1139,6 +1092,57 @@ export const duplicateProductServicesMutation = (
|
||||
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);
|
||||
@ -1268,6 +1272,54 @@ export const updateDealServiceMutation = (
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const addKitToDealQueryKey = (options: Options<AddKitToDealData>) =>
|
||||
createQueryKey("addKitToDeal", options);
|
||||
|
||||
/**
|
||||
* Add Kit To Deal Product
|
||||
*/
|
||||
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 Product
|
||||
*/
|
||||
export const addKitToDealMutation = (
|
||||
options?: Partial<Options<AddKitToDealData>>
|
||||
): UseMutationOptions<
|
||||
AddKitToDealResponse,
|
||||
AxiosError<AddKitToDealError>,
|
||||
Options<AddKitToDealData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
AddKitToDealResponse,
|
||||
AxiosError<AddKitToDealError>,
|
||||
Options<AddKitToDealData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await addKitToDeal({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
|
||||
createQueryKey("getProducts", options);
|
||||
|
||||
|
||||
@ -3,9 +3,12 @@
|
||||
import type { Client, Options as ClientOptions, TDataShape } from "./client";
|
||||
import { client as _heyApiClient } from "./client.gen";
|
||||
import type {
|
||||
AddKitToDealData,
|
||||
AddKitToDealErrors,
|
||||
AddKitToDealProductData,
|
||||
AddKitToDealProductErrors,
|
||||
AddKitToDealProductResponses,
|
||||
AddKitToDealResponses,
|
||||
CreateBoardData,
|
||||
CreateBoardErrors,
|
||||
CreateBoardResponses,
|
||||
@ -127,8 +130,10 @@ import type {
|
||||
UpdateStatusResponses,
|
||||
} from "./types.gen";
|
||||
import {
|
||||
zAddKitToDealData,
|
||||
zAddKitToDealProductData,
|
||||
zAddKitToDealProductResponse,
|
||||
zAddKitToDealResponse,
|
||||
zCreateBoardData,
|
||||
zCreateBoardResponse2,
|
||||
zCreateDealData,
|
||||
@ -753,33 +758,6 @@ export const updateDealProduct = <ThrowOnError extends boolean = false>(
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Add Kit To Deal Product
|
||||
*/
|
||||
export const addKitToDealProduct = <ThrowOnError extends boolean = false>(
|
||||
options: Options<AddKitToDealProductData, ThrowOnError>
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
AddKitToDealProductResponses,
|
||||
AddKitToDealProductErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
requestValidator: async data => {
|
||||
return await zAddKitToDealProductData.parseAsync(data);
|
||||
},
|
||||
responseType: "json",
|
||||
responseValidator: async data => {
|
||||
return await zAddKitToDealProductResponse.parseAsync(data);
|
||||
},
|
||||
url: "/modules/fulfillment-base/deal-product/add-services-kit",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Deal Product Service
|
||||
*/
|
||||
@ -884,6 +862,33 @@ export const duplicateProductServices = <ThrowOnError extends boolean = false>(
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Add Kit To Deal Product
|
||||
*/
|
||||
export const addKitToDealProduct = <ThrowOnError extends boolean = false>(
|
||||
options: Options<AddKitToDealProductData, ThrowOnError>
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
AddKitToDealProductResponses,
|
||||
AddKitToDealProductErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
requestValidator: async data => {
|
||||
return await zAddKitToDealProductData.parseAsync(data);
|
||||
},
|
||||
responseType: "json",
|
||||
responseValidator: async data => {
|
||||
return await zAddKitToDealProductResponse.parseAsync(data);
|
||||
},
|
||||
url: "/modules/fulfillment-base/deal-product/add-services-kit",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Deal Services
|
||||
*/
|
||||
@ -984,6 +989,33 @@ export const updateDealService = <ThrowOnError extends boolean = false>(
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Add Kit To Deal Product
|
||||
*/
|
||||
export const addKitToDeal = <ThrowOnError extends boolean = false>(
|
||||
options: Options<AddKitToDealData, ThrowOnError>
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
AddKitToDealResponses,
|
||||
AddKitToDealErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
requestValidator: async data => {
|
||||
return await zAddKitToDealData.parseAsync(data);
|
||||
},
|
||||
responseType: "json",
|
||||
responseValidator: async data => {
|
||||
return await zAddKitToDealResponse.parseAsync(data);
|
||||
},
|
||||
url: "/modules/fulfillment-base/deal-service/add-services-kit",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Products
|
||||
*/
|
||||
|
||||
@ -453,6 +453,30 @@ export type CreateStatusSchema = {
|
||||
lexorank: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* DealAddKitRequest
|
||||
*/
|
||||
export type DealAddKitRequest = {
|
||||
/**
|
||||
* Dealid
|
||||
*/
|
||||
dealId: number;
|
||||
/**
|
||||
* Kitid
|
||||
*/
|
||||
kitId: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* DealAddKitResponse
|
||||
*/
|
||||
export type DealAddKitResponse = {
|
||||
/**
|
||||
* Message
|
||||
*/
|
||||
message: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* DealProductAddKitRequest
|
||||
*/
|
||||
@ -2071,33 +2095,6 @@ export type UpdateDealProductResponses = {
|
||||
export type UpdateDealProductResponse2 =
|
||||
UpdateDealProductResponses[keyof UpdateDealProductResponses];
|
||||
|
||||
export type AddKitToDealProductData = {
|
||||
body: DealProductAddKitRequest;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: "/modules/fulfillment-base/deal-product/add-services-kit";
|
||||
};
|
||||
|
||||
export type AddKitToDealProductErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type AddKitToDealProductError =
|
||||
AddKitToDealProductErrors[keyof AddKitToDealProductErrors];
|
||||
|
||||
export type AddKitToDealProductResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DealProductAddKitResponse;
|
||||
};
|
||||
|
||||
export type AddKitToDealProductResponse =
|
||||
AddKitToDealProductResponses[keyof AddKitToDealProductResponses];
|
||||
|
||||
export type CreateDealProductServiceData = {
|
||||
body: CreateProductServiceRequest;
|
||||
path?: never;
|
||||
@ -2232,6 +2229,33 @@ export type DuplicateProductServicesResponses = {
|
||||
export type DuplicateProductServicesResponse =
|
||||
DuplicateProductServicesResponses[keyof DuplicateProductServicesResponses];
|
||||
|
||||
export type AddKitToDealProductData = {
|
||||
body: DealProductAddKitRequest;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: "/modules/fulfillment-base/deal-product/add-services-kit";
|
||||
};
|
||||
|
||||
export type AddKitToDealProductErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type AddKitToDealProductError =
|
||||
AddKitToDealProductErrors[keyof AddKitToDealProductErrors];
|
||||
|
||||
export type AddKitToDealProductResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DealProductAddKitResponse;
|
||||
};
|
||||
|
||||
export type AddKitToDealProductResponse =
|
||||
AddKitToDealProductResponses[keyof AddKitToDealProductResponses];
|
||||
|
||||
export type GetDealServicesData = {
|
||||
body?: never;
|
||||
path: {
|
||||
@ -2363,6 +2387,32 @@ export type UpdateDealServiceResponses = {
|
||||
export type UpdateDealServiceResponse2 =
|
||||
UpdateDealServiceResponses[keyof UpdateDealServiceResponses];
|
||||
|
||||
export type AddKitToDealData = {
|
||||
body: DealAddKitRequest;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: "/modules/fulfillment-base/deal-service/add-services-kit";
|
||||
};
|
||||
|
||||
export type AddKitToDealErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type AddKitToDealError = AddKitToDealErrors[keyof AddKitToDealErrors];
|
||||
|
||||
export type AddKitToDealResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DealAddKitResponse;
|
||||
};
|
||||
|
||||
export type AddKitToDealResponse =
|
||||
AddKitToDealResponses[keyof AddKitToDealResponses];
|
||||
|
||||
export type GetProductsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
|
||||
@ -402,6 +402,21 @@ export const zCreateStatusResponse = z.object({
|
||||
entity: zStatusSchema,
|
||||
});
|
||||
|
||||
/**
|
||||
* DealAddKitRequest
|
||||
*/
|
||||
export const zDealAddKitRequest = z.object({
|
||||
dealId: z.int(),
|
||||
kitId: z.int(),
|
||||
});
|
||||
|
||||
/**
|
||||
* DealAddKitResponse
|
||||
*/
|
||||
export const zDealAddKitResponse = z.object({
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* DealProductAddKitRequest
|
||||
*/
|
||||
@ -1118,17 +1133,6 @@ export const zUpdateDealProductData = z.object({
|
||||
*/
|
||||
export const zUpdateDealProductResponse2 = zUpdateDealProductResponse;
|
||||
|
||||
export const zAddKitToDealProductData = z.object({
|
||||
body: zDealProductAddKitRequest,
|
||||
path: z.optional(z.never()),
|
||||
query: z.optional(z.never()),
|
||||
});
|
||||
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
export const zAddKitToDealProductResponse = zDealProductAddKitResponse;
|
||||
|
||||
export const zCreateDealProductServiceData = z.object({
|
||||
body: zCreateProductServiceRequest,
|
||||
path: z.optional(z.never()),
|
||||
@ -1182,6 +1186,17 @@ export const zDuplicateProductServicesData = z.object({
|
||||
export const zDuplicateProductServicesResponse =
|
||||
zProductServicesDuplicateResponse;
|
||||
|
||||
export const zAddKitToDealProductData = z.object({
|
||||
body: zDealProductAddKitRequest,
|
||||
path: z.optional(z.never()),
|
||||
query: z.optional(z.never()),
|
||||
});
|
||||
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
export const zAddKitToDealProductResponse = zDealProductAddKitResponse;
|
||||
|
||||
export const zGetDealServicesData = z.object({
|
||||
body: z.optional(z.never()),
|
||||
path: z.object({
|
||||
@ -1234,6 +1249,17 @@ export const zUpdateDealServiceData = z.object({
|
||||
*/
|
||||
export const zUpdateDealServiceResponse2 = zUpdateDealServiceResponse;
|
||||
|
||||
export const zAddKitToDealData = z.object({
|
||||
body: zDealAddKitRequest,
|
||||
path: z.optional(z.never()),
|
||||
query: z.optional(z.never()),
|
||||
});
|
||||
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
export const zAddKitToDealResponse = zDealAddKitResponse;
|
||||
|
||||
export const zGetProductsData = z.object({
|
||||
body: z.optional(z.never()),
|
||||
path: z.optional(z.never()),
|
||||
|
||||
Reference in New Issue
Block a user