feat(api): generate models for patched products, refunds, site configurations, payments, and user registration
- Added PatchedProduct, PatchedProductImage, PatchedRefund, and related models. - Introduced Payment, PaymentBody, PaymentCreate, and PaymentRead models. - Created enums for payment methods, reasons for refunds, roles, and shipping methods. - Implemented models for site configurations and their opening hours. - Added ZasilkovnaPacket and ZasilkovnaShipment models for handling shipping data. - Generated user registration model with validation rules. - Updated public API functions to support new models and queries.
This commit is contained in:
@@ -0,0 +1,463 @@
|
||||
/**
|
||||
* Generated by orval v7.17.0 🍺
|
||||
* Do not edit manually.
|
||||
* OpenAPI spec version: 0.0.0
|
||||
*/
|
||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
||||
import type {
|
||||
DataTag,
|
||||
DefinedInitialDataOptions,
|
||||
DefinedUseInfiniteQueryResult,
|
||||
DefinedUseQueryResult,
|
||||
InfiniteData,
|
||||
MutationFunction,
|
||||
QueryClient,
|
||||
QueryFunction,
|
||||
QueryKey,
|
||||
UndefinedInitialDataOptions,
|
||||
UseInfiniteQueryOptions,
|
||||
UseInfiniteQueryResult,
|
||||
UseMutationOptions,
|
||||
UseMutationResult,
|
||||
UseQueryOptions,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
|
||||
import type { UserRegistration } from ".././models";
|
||||
|
||||
import { privateMutator } from "../../../privateClient";
|
||||
|
||||
/**
|
||||
* Register a new user (company or individual). The user will receive an email with a verification link.
|
||||
* @summary Register a new user (company or individual)
|
||||
*/
|
||||
export const apiAccountRegisterCreate = (
|
||||
userRegistration: UserRegistration,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return privateMutator<UserRegistration>({
|
||||
url: `/api/account/register/`,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: userRegistration,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getApiAccountRegisterCreateMutationOptions = <
|
||||
TError = void,
|
||||
TContext = unknown,
|
||||
>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
||||
TError,
|
||||
{ data: UserRegistration },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
||||
TError,
|
||||
{ data: UserRegistration },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["apiAccountRegisterCreate"];
|
||||
const { mutation: mutationOptions } = options
|
||||
? options.mutation &&
|
||||
"mutationKey" in options.mutation &&
|
||||
options.mutation.mutationKey
|
||||
? options
|
||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||
: { mutation: { mutationKey } };
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
||||
{ data: UserRegistration }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
return apiAccountRegisterCreate(data);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type ApiAccountRegisterCreateMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof apiAccountRegisterCreate>>
|
||||
>;
|
||||
export type ApiAccountRegisterCreateMutationBody = UserRegistration;
|
||||
export type ApiAccountRegisterCreateMutationError = void;
|
||||
|
||||
/**
|
||||
* @summary Register a new user (company or individual)
|
||||
*/
|
||||
export const useApiAccountRegisterCreate = <TError = void, TContext = unknown>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
||||
TError,
|
||||
{ data: UserRegistration },
|
||||
TContext
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
||||
TError,
|
||||
{ data: UserRegistration },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getApiAccountRegisterCreateMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
};
|
||||
/**
|
||||
* Verify user email using the link with uid and token.
|
||||
* @summary Verify user email via link
|
||||
*/
|
||||
export const apiAccountVerifyEmailRetrieve = (
|
||||
uidb64: string,
|
||||
token: string,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return privateMutator<void>({
|
||||
url: `/api/account/verify-email/${uidb64}/${token}/`,
|
||||
method: "GET",
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveInfiniteQueryKey = (
|
||||
uidb64?: string,
|
||||
token?: string,
|
||||
) => {
|
||||
return ["infinite", `/api/account/verify-email/${uidb64}/${token}/`] as const;
|
||||
};
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
||||
uidb64?: string,
|
||||
token?: string,
|
||||
) => {
|
||||
return [`/api/account/verify-email/${uidb64}/${token}/`] as const;
|
||||
};
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveInfiniteQueryOptions = <
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getApiAccountVerifyEmailRetrieveInfiniteQueryKey(uidb64, token);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
> = ({ signal }) => apiAccountVerifyEmailRetrieve(uidb64, token, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!(uidb64 && token),
|
||||
...queryOptions,
|
||||
} as UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type ApiAccountVerifyEmailRetrieveInfiniteQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>;
|
||||
export type ApiAccountVerifyEmailRetrieveInfiniteQueryError = void;
|
||||
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Verify user email via link
|
||||
*/
|
||||
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getApiAccountVerifyEmailRetrieveInfiniteQueryOptions(
|
||||
uidb64,
|
||||
token,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useInfiniteQuery(
|
||||
queryOptions,
|
||||
queryClient,
|
||||
) as UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getApiAccountVerifyEmailRetrieveQueryKey(uidb64, token);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
> = ({ signal }) => apiAccountVerifyEmailRetrieve(uidb64, token, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!(uidb64 && token),
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type ApiAccountVerifyEmailRetrieveQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>;
|
||||
export type ApiAccountVerifyEmailRetrieveQueryError = void;
|
||||
|
||||
export function useApiAccountVerifyEmailRetrieve<
|
||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useApiAccountVerifyEmailRetrieve<
|
||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useApiAccountVerifyEmailRetrieve<
|
||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Verify user email via link
|
||||
*/
|
||||
|
||||
export function useApiAccountVerifyEmailRetrieve<
|
||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getApiAccountVerifyEmailRetrieveQueryOptions(
|
||||
uidb64,
|
||||
token,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
}
|
||||
Reference in New Issue
Block a user