- 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.
180 lines
4.4 KiB
TypeScript
180 lines
4.4 KiB
TypeScript
/**
|
|
* Generated by orval v7.17.0 🍺
|
|
* Do not edit manually.
|
|
* OpenAPI spec version: 0.0.0
|
|
*/
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import type {
|
|
DataTag,
|
|
DefinedInitialDataOptions,
|
|
DefinedUseQueryResult,
|
|
QueryClient,
|
|
QueryFunction,
|
|
QueryKey,
|
|
UndefinedInitialDataOptions,
|
|
UseQueryOptions,
|
|
UseQueryResult,
|
|
} from "@tanstack/react-query";
|
|
|
|
import type { ApiChoicesRetrieve200, ApiChoicesRetrieveParams } from "./models";
|
|
|
|
import { publicMutator } from "../../publicClient";
|
|
|
|
/**
|
|
* Vrátí všechny možné hodnoty pro ChoiceField s podporou vícejazyčných labelů. Umožňuje načíst více modelů a polí najednou.
|
|
*/
|
|
export const apiChoicesRetrieve = (
|
|
params: ApiChoicesRetrieveParams,
|
|
signal?: AbortSignal,
|
|
) => {
|
|
return publicMutator<ApiChoicesRetrieve200>({
|
|
url: `/api/choices/`,
|
|
method: "GET",
|
|
params,
|
|
signal,
|
|
});
|
|
};
|
|
|
|
export const getApiChoicesRetrieveQueryKey = (
|
|
params?: ApiChoicesRetrieveParams,
|
|
) => {
|
|
return [`/api/choices/`, ...(params ? [params] : [])] as const;
|
|
};
|
|
|
|
export const getApiChoicesRetrieveQueryOptions = <
|
|
TData = Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError = unknown,
|
|
>(
|
|
params: ApiChoicesRetrieveParams,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
>;
|
|
},
|
|
) => {
|
|
const { query: queryOptions } = options ?? {};
|
|
|
|
const queryKey =
|
|
queryOptions?.queryKey ?? getApiChoicesRetrieveQueryKey(params);
|
|
|
|
const queryFn: QueryFunction<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>
|
|
> = ({ signal }) => apiChoicesRetrieve(params, signal);
|
|
|
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
TData
|
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
};
|
|
|
|
export type ApiChoicesRetrieveQueryResult = NonNullable<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>
|
|
>;
|
|
export type ApiChoicesRetrieveQueryError = unknown;
|
|
|
|
export function useApiChoicesRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError = unknown,
|
|
>(
|
|
params: ApiChoicesRetrieveParams,
|
|
options: {
|
|
query: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
> &
|
|
Pick<
|
|
DefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>
|
|
>,
|
|
"initialData"
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): DefinedUseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
export function useApiChoicesRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError = unknown,
|
|
>(
|
|
params: ApiChoicesRetrieveParams,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
> &
|
|
Pick<
|
|
UndefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>
|
|
>,
|
|
"initialData"
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
export function useApiChoicesRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError = unknown,
|
|
>(
|
|
params: ApiChoicesRetrieveParams,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
|
|
export function useApiChoicesRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError = unknown,
|
|
>(
|
|
params: ApiChoicesRetrieveParams,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiChoicesRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
} {
|
|
const queryOptions = getApiChoicesRetrieveQueryOptions(params, options);
|
|
|
|
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
|
TData,
|
|
TError
|
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
|
|
query.queryKey = queryOptions.queryKey;
|
|
|
|
return query;
|
|
}
|