Refactor API hooks to remove infinite query support and update API client base URL
- Removed infinite query options and related functions from Trading212, User Registration, and User API files. - Updated API client base URLs in privateClient.ts and publicClient.ts to use environment variable for backend URL. - Refactored Downloader component to directly call API functions for video info retrieval instead of using a hook.
This commit is contained in:
108
.github/copilot-instructions.md
vendored
108
.github/copilot-instructions.md
vendored
@@ -107,12 +107,108 @@ Notes
|
|||||||
- **Task queue**: Celery + Redis for async/background jobs.
|
- **Task queue**: Celery + Redis for async/background jobs.
|
||||||
- **API**: REST endpoints, JWT auth, API key support.
|
- **API**: REST endpoints, JWT auth, API key support.
|
||||||
|
|
||||||
### OpenAPI Client Generation
|
### OpenAPI Client Generation (Orval)
|
||||||
- Schema: `config = { schemaUrl: "/api/schema/", baseUrl: "/api/" }`
|
This project uses **Orval** to auto-generate TypeScript API clients from the Django OpenAPI schema.
|
||||||
- Commands: `npm run api:update` (fetch schema + generate client)
|
|
||||||
- Output: `frontend/src/api/generated/` (TypeScript Axios client)
|
#### Configuration
|
||||||
- Axios instance: `frontend/src/api/api.ts` with `withCredentials` and JWT auto-refresh via existing `Client.ts`.
|
- **Orval config**: `frontend/src/orval.config.ts`
|
||||||
- Choices helper: `frontend/src/api/get_choices.ts` → `getChoices(requests, lang)` returns `{ "Model.field": [{ value, label }] }`.
|
- **Schema URL**: `/api/schema/` (DRF Spectacular endpoint)
|
||||||
|
- **Fetch script**: `frontend/scripts/fetch-openapi.js`
|
||||||
|
- **Commands**:
|
||||||
|
- `npm run api:update` — fetches schema + generates client
|
||||||
|
- Runs: `node scripts/fetch-openapi.js && npx orval`
|
||||||
|
|
||||||
|
#### Generated Output
|
||||||
|
- **Location**: `frontend/src/api/generated/`
|
||||||
|
- **Files**: TypeScript interfaces, Axios-based API hooks
|
||||||
|
- Uses custom mutators: `publicMutator` and `privateMutator`
|
||||||
|
|
||||||
|
#### Custom Mutators
|
||||||
|
Two Axios clients handle public/private API requests:
|
||||||
|
|
||||||
|
**Public Client** (`frontend/src/api/publicClient.ts`):
|
||||||
|
```ts
|
||||||
|
import axios, { type AxiosRequestConfig } from "axios";
|
||||||
|
|
||||||
|
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:8000";
|
||||||
|
|
||||||
|
export const publicApi = axios.create({
|
||||||
|
baseURL: backendUrl + "/api/",
|
||||||
|
withCredentials: false, // no cookies for public endpoints
|
||||||
|
});
|
||||||
|
|
||||||
|
export const publicMutator = async <T>(config: AxiosRequestConfig): Promise<T> => {
|
||||||
|
const response = await publicApi.request<T>(config);
|
||||||
|
return response.data;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
**Private Client** (`frontend/src/api/privateClient.ts`):
|
||||||
|
```ts
|
||||||
|
import axios, { type AxiosRequestConfig } from "axios";
|
||||||
|
|
||||||
|
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:8000";
|
||||||
|
|
||||||
|
export const privateApi = axios.create({
|
||||||
|
baseURL: backendUrl + "/api/",
|
||||||
|
withCredentials: true, // sends HttpOnly cookies (access/refresh tokens)
|
||||||
|
});
|
||||||
|
|
||||||
|
// Auto-refresh on 401
|
||||||
|
privateApi.interceptors.response.use(
|
||||||
|
(res) => res,
|
||||||
|
async (error) => {
|
||||||
|
const original = error.config;
|
||||||
|
if (error.response?.status === 401 && !original._retry) {
|
||||||
|
original._retry = true;
|
||||||
|
try {
|
||||||
|
await privateApi.post("/auth/refresh/");
|
||||||
|
return privateApi(original);
|
||||||
|
} catch {
|
||||||
|
// optional: logout
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export const privateMutator = async <T>(config: AxiosRequestConfig): Promise<T> => {
|
||||||
|
const response = await privateApi.request<T>(config);
|
||||||
|
return response.data;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Environment Variables (Vite)
|
||||||
|
- **IMPORTANT**: Use `import.meta.env.VITE_*` instead of `process.env` in browser code
|
||||||
|
- **NEVER** import `dotenv/config` in frontend files (causes "process is not defined" error)
|
||||||
|
- **Available vars**:
|
||||||
|
- `VITE_BACKEND_URL` (default: `http://localhost:8000`)
|
||||||
|
- `VITE_API_BASE_URL` (if using Client.ts wrapper)
|
||||||
|
- `VITE_API_REFRESH_URL` (default: `/api/token/refresh/`)
|
||||||
|
- `VITE_LOGIN_PATH` (default: `/login`)
|
||||||
|
|
||||||
|
#### Usage Example
|
||||||
|
```ts
|
||||||
|
import { useGetOrders } from "@/api/generated/orders";
|
||||||
|
|
||||||
|
function OrdersList() {
|
||||||
|
const { data, isLoading, error } = useGetOrders();
|
||||||
|
|
||||||
|
if (isLoading) return <div>Loading...</div>;
|
||||||
|
if (error) return <div>Error: {error.message}</div>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul>
|
||||||
|
{data?.map(order => <li key={order.id}>{order.status}</li>)}
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Helpers
|
||||||
|
- **Choices helper**: `frontend/src/api/get_choices.ts`
|
||||||
|
- Function: `getChoices(requests, lang)`
|
||||||
|
- Returns: `{ "Model.field": [{ value, label }] }`
|
||||||
|
|
||||||
## References
|
## References
|
||||||
- [frontend/REACT.md](../frontend/REACT.md): Frontend structure, workflows, and conventions.
|
- [frontend/REACT.md](../frontend/REACT.md): Frontend structure, workflows, and conventions.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -75,203 +71,12 @@ export const apiCommerceCategoriesList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceCategoriesListInfiniteQueryKey = (
|
|
||||||
params?: ApiCommerceCategoriesListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/commerce/categories/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceCategoriesListQueryKey = (
|
export const getApiCommerceCategoriesListQueryKey = (
|
||||||
params?: ApiCommerceCategoriesListParams,
|
params?: ApiCommerceCategoriesListParams,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/commerce/categories/`, ...(params ? [params] : [])] as const;
|
return [`/api/commerce/categories/`, ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceCategoriesListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceCategoriesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceCategoriesListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiCommerceCategoriesList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceCategoriesListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceCategoriesListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceCategoriesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiCommerceCategoriesListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceCategoriesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceCategoriesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceCategoriesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceCategoriesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List categories (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceCategoriesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceCategoriesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceCategoriesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceCategoriesListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceCategoriesListQueryOptions = <
|
export const getApiCommerceCategoriesListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
TData = Awaited<ReturnType<typeof apiCommerceCategoriesList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -515,177 +320,10 @@ export const apiCommerceCategoriesRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceCategoriesRetrieveInfiniteQueryKey = (
|
|
||||||
id?: number,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/commerce/categories/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceCategoriesRetrieveQueryKey = (id?: number) => {
|
export const getApiCommerceCategoriesRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/commerce/categories/${id}/`] as const;
|
return [`/api/commerce/categories/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceCategoriesRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceCategoriesRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
> = ({ signal }) => apiCommerceCategoriesRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceCategoriesRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceCategoriesRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceCategoriesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceCategoriesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceCategoriesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Retrieve category (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceCategoriesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceCategoriesRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceCategoriesRetrieveQueryOptions = <
|
export const getApiCommerceCategoriesRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiCommerceCategoriesRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -75,16 +71,6 @@ export const apiCommerceDiscountCodesList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesListInfiniteQueryKey = (
|
|
||||||
params?: ApiCommerceDiscountCodesListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/commerce/discount-codes/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesListQueryKey = (
|
export const getApiCommerceDiscountCodesListQueryKey = (
|
||||||
params?: ApiCommerceDiscountCodesListParams,
|
params?: ApiCommerceDiscountCodesListParams,
|
||||||
) => {
|
) => {
|
||||||
@@ -94,187 +80,6 @@ export const getApiCommerceDiscountCodesListQueryKey = (
|
|||||||
] as const;
|
] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceDiscountCodesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceDiscountCodesListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiCommerceDiscountCodesList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceDiscountCodesListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceDiscountCodesListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceDiscountCodesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiCommerceDiscountCodesListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceDiscountCodesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceDiscountCodesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceDiscountCodesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceDiscountCodesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List discount codes (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceDiscountCodesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceDiscountCodesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceDiscountCodesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceDiscountCodesListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesListQueryOptions = <
|
export const getApiCommerceDiscountCodesListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
TData = Awaited<ReturnType<typeof apiCommerceDiscountCodesList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -519,177 +324,10 @@ export const apiCommerceDiscountCodesRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesRetrieveInfiniteQueryKey = (
|
|
||||||
id?: number,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/commerce/discount-codes/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesRetrieveQueryKey = (id?: number) => {
|
export const getApiCommerceDiscountCodesRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/commerce/discount-codes/${id}/`] as const;
|
return [`/api/commerce/discount-codes/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceDiscountCodesRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
> = ({ signal }) => apiCommerceDiscountCodesRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceDiscountCodesRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceDiscountCodesRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceDiscountCodesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceDiscountCodesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceDiscountCodesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Retrieve discount code (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceDiscountCodesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceDiscountCodesRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceDiscountCodesRetrieveQueryOptions = <
|
export const getApiCommerceDiscountCodesRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiCommerceDiscountCodesRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -157,164 +153,10 @@ export const gopayGetStatus = (paymentId: string, signal?: AbortSignal) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGopayGetStatusInfiniteQueryKey = (paymentId?: string) => {
|
|
||||||
return ["infinite", `/api/payments/gopay/${paymentId}/status/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getGopayGetStatusQueryKey = (paymentId?: string) => {
|
export const getGopayGetStatusQueryKey = (paymentId?: string) => {
|
||||||
return [`/api/payments/gopay/${paymentId}/status/`] as const;
|
return [`/api/payments/gopay/${paymentId}/status/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGopayGetStatusInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof gopayGetStatus>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
paymentId: string,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getGopayGetStatusInfiniteQueryKey(paymentId);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof gopayGetStatus>>> = ({
|
|
||||||
signal,
|
|
||||||
}) => gopayGetStatus(paymentId, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!paymentId,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GopayGetStatusInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>
|
|
||||||
>;
|
|
||||||
export type GopayGetStatusInfiniteQueryError = void;
|
|
||||||
|
|
||||||
export function useGopayGetStatusInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof gopayGetStatus>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
paymentId: string,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useGopayGetStatusInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof gopayGetStatus>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
paymentId: string,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useGopayGetStatusInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof gopayGetStatus>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
paymentId: string,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Získat stav platby
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useGopayGetStatusInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof gopayGetStatus>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
paymentId: string,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof gopayGetStatus>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getGopayGetStatusInfiniteQueryOptions(
|
|
||||||
paymentId,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getGopayGetStatusQueryOptions = <
|
export const getGopayGetStatusQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof gopayGetStatus>>,
|
TData = Awaited<ReturnType<typeof gopayGetStatus>>,
|
||||||
TError = void,
|
TError = void,
|
||||||
|
|||||||
@@ -3,19 +3,15 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
UseQueryResult,
|
UseQueryResult,
|
||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
@@ -43,202 +39,12 @@ export const apiCommerceOrdersList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceOrdersListInfiniteQueryKey = (
|
|
||||||
params?: ApiCommerceOrdersListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/commerce/orders/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceOrdersListQueryKey = (
|
export const getApiCommerceOrdersListQueryKey = (
|
||||||
params?: ApiCommerceOrdersListParams,
|
params?: ApiCommerceOrdersListParams,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/commerce/orders/`, ...(params ? [params] : [])] as const;
|
return [`/api/commerce/orders/`, ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceOrdersListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceOrdersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiCommerceOrdersListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiCommerceOrdersList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceOrdersListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceOrdersListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceOrdersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiCommerceOrdersListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceOrdersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceOrdersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceOrdersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceOrdersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List Orders (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceOrdersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceOrdersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceOrdersListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceOrdersListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceOrdersListQueryOptions = <
|
export const getApiCommerceOrdersListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
TData = Awaited<ReturnType<typeof apiCommerceOrdersList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -390,164 +196,10 @@ export const apiCommerceOrdersRetrieve = (id: number, signal?: AbortSignal) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceOrdersRetrieveInfiniteQueryKey = (id?: number) => {
|
|
||||||
return ["infinite", `/api/commerce/orders/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceOrdersRetrieveQueryKey = (id?: number) => {
|
export const getApiCommerceOrdersRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/commerce/orders/${id}/`] as const;
|
return [`/api/commerce/orders/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceOrdersRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiCommerceOrdersRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>
|
|
||||||
> = ({ signal }) => apiCommerceOrdersRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceOrdersRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceOrdersRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceOrdersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceOrdersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceOrdersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Retrieve Order (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceOrdersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceOrdersRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceOrdersRetrieveQueryOptions = <
|
export const getApiCommerceOrdersRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiCommerceOrdersRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -42,177 +38,10 @@ export const apiZasilkovnaPacketsRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsRetrieveInfiniteQueryKey = (
|
|
||||||
id?: number,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/zasilkovna/packets/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsRetrieveQueryKey = (id?: number) => {
|
export const getApiZasilkovnaPacketsRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/zasilkovna/packets/${id}/`] as const;
|
return [`/api/zasilkovna/packets/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiZasilkovnaPacketsRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
> = ({ signal }) => apiZasilkovnaPacketsRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiZasilkovnaPacketsRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiZasilkovnaPacketsRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiZasilkovnaPacketsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaPacketsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaPacketsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Packet
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiZasilkovnaPacketsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiZasilkovnaPacketsRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsRetrieveQueryOptions = <
|
export const getApiZasilkovnaPacketsRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -541,204 +370,12 @@ export const apiZasilkovnaPacketsPickupPointWidgetRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryKey =
|
|
||||||
(id?: number) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/zasilkovna/packets/${id}/pickup-point-widget/`,
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryKey = (
|
export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryKey = (
|
||||||
id?: number,
|
id?: number,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/zasilkovna/packets/${id}/pickup-point-widget/`] as const;
|
return [`/api/zasilkovna/packets/${id}/pickup-point-widget/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryOptions =
|
|
||||||
<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
> = ({ signal }) =>
|
|
||||||
apiZasilkovnaPacketsPickupPointWidgetRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryResult =
|
|
||||||
NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryError =
|
|
||||||
unknown;
|
|
||||||
|
|
||||||
export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Get widget for user, to select pickup point.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiZasilkovnaPacketsPickupPointWidgetRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<
|
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
|
||||||
>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions =
|
|
||||||
getApiZasilkovnaPacketsPickupPointWidgetRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryOptions = <
|
export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryOptions = <
|
||||||
TData = Awaited<
|
TData = Awaited<
|
||||||
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
|
||||||
@@ -930,178 +567,12 @@ export const apiZasilkovnaPacketsTrackingUrlRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryKey = (
|
|
||||||
id?: number,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/zasilkovna/packets/${id}/tracking-url/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryKey = (
|
export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryKey = (
|
||||||
id?: number,
|
id?: number,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/zasilkovna/packets/${id}/tracking-url/`] as const;
|
return [`/api/zasilkovna/packets/${id}/tracking-url/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
> = ({ signal }) => apiZasilkovnaPacketsTrackingUrlRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryResult =
|
|
||||||
NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Get public tracking URL
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiZasilkovnaPacketsTrackingUrlRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions =
|
|
||||||
getApiZasilkovnaPacketsTrackingUrlRetrieveInfiniteQueryOptions(id, options);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryOptions = <
|
export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,19 +3,15 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
UseQueryResult,
|
UseQueryResult,
|
||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
@@ -44,203 +40,12 @@ export const apiZasilkovnaShipmentsList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsListInfiniteQueryKey = (
|
|
||||||
params?: ApiZasilkovnaShipmentsListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/zasilkovna/shipments/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsListQueryKey = (
|
export const getApiZasilkovnaShipmentsListQueryKey = (
|
||||||
params?: ApiZasilkovnaShipmentsListParams,
|
params?: ApiZasilkovnaShipmentsListParams,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/zasilkovna/shipments/`, ...(params ? [params] : [])] as const;
|
return [`/api/zasilkovna/shipments/`, ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiZasilkovnaShipmentsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiZasilkovnaShipmentsListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiZasilkovnaShipmentsList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiZasilkovnaShipmentsListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>
|
|
||||||
>;
|
|
||||||
export type ApiZasilkovnaShipmentsListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiZasilkovnaShipmentsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiZasilkovnaShipmentsListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaShipmentsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiZasilkovnaShipmentsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaShipmentsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiZasilkovnaShipmentsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Hromadný shipment
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiZasilkovnaShipmentsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiZasilkovnaShipmentsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiZasilkovnaShipmentsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiZasilkovnaShipmentsListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsListQueryOptions = <
|
export const getApiZasilkovnaShipmentsListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -399,177 +204,10 @@ export const apiZasilkovnaShipmentsRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsRetrieveInfiniteQueryKey = (
|
|
||||||
id?: number,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/zasilkovna/shipments/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsRetrieveQueryKey = (id?: number) => {
|
export const getApiZasilkovnaShipmentsRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/zasilkovna/shipments/${id}/`] as const;
|
return [`/api/zasilkovna/shipments/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiZasilkovnaShipmentsRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
> = ({ signal }) => apiZasilkovnaShipmentsRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiZasilkovnaShipmentsRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiZasilkovnaShipmentsRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiZasilkovnaShipmentsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaShipmentsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiZasilkovnaShipmentsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Detail hromadné zásilky
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiZasilkovnaShipmentsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiZasilkovnaShipmentsRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiZasilkovnaShipmentsRetrieveQueryOptions = <
|
export const getApiZasilkovnaShipmentsRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -75,16 +71,6 @@ export const apiCommerceProductImagesList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductImagesListInfiniteQueryKey = (
|
|
||||||
params?: ApiCommerceProductImagesListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/commerce/product-images/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceProductImagesListQueryKey = (
|
export const getApiCommerceProductImagesListQueryKey = (
|
||||||
params?: ApiCommerceProductImagesListParams,
|
params?: ApiCommerceProductImagesListParams,
|
||||||
) => {
|
) => {
|
||||||
@@ -94,187 +80,6 @@ export const getApiCommerceProductImagesListQueryKey = (
|
|||||||
] as const;
|
] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductImagesListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductImagesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceProductImagesListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiCommerceProductImagesList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceProductImagesListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceProductImagesListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceProductImagesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiCommerceProductImagesListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductImagesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductImagesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductImagesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductImagesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List product images (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceProductImagesListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductImagesListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductImagesListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceProductImagesListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceProductImagesListQueryOptions = <
|
export const getApiCommerceProductImagesListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
TData = Awaited<ReturnType<typeof apiCommerceProductImagesList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -519,177 +324,10 @@ export const apiCommerceProductImagesRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductImagesRetrieveInfiniteQueryKey = (
|
|
||||||
id?: number,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/commerce/product-images/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceProductImagesRetrieveQueryKey = (id?: number) => {
|
export const getApiCommerceProductImagesRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/commerce/product-images/${id}/`] as const;
|
return [`/api/commerce/product-images/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductImagesRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceProductImagesRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
> = ({ signal }) => apiCommerceProductImagesRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceProductImagesRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceProductImagesRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceProductImagesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductImagesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductImagesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Retrieve product image (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceProductImagesRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceProductImagesRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceProductImagesRetrieveQueryOptions = <
|
export const getApiCommerceProductImagesRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiCommerceProductImagesRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -75,203 +71,12 @@ export const apiCommerceProductsList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductsListInfiniteQueryKey = (
|
|
||||||
params?: ApiCommerceProductsListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/commerce/products/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceProductsListQueryKey = (
|
export const getApiCommerceProductsListQueryKey = (
|
||||||
params?: ApiCommerceProductsListParams,
|
params?: ApiCommerceProductsListParams,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/commerce/products/`, ...(params ? [params] : [])] as const;
|
return [`/api/commerce/products/`, ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductsListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceProductsListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiCommerceProductsList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceProductsListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceProductsListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceProductsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiCommerceProductsListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List products (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceProductsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceProductsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceProductsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceProductsListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceProductsListQueryOptions = <
|
export const getApiCommerceProductsListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
TData = Awaited<ReturnType<typeof apiCommerceProductsList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -511,165 +316,10 @@ export const apiCommerceProductsRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductsRetrieveInfiniteQueryKey = (id?: number) => {
|
|
||||||
return ["infinite", `/api/commerce/products/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceProductsRetrieveQueryKey = (id?: number) => {
|
export const getApiCommerceProductsRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/commerce/products/${id}/`] as const;
|
return [`/api/commerce/products/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceProductsRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiCommerceProductsRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>
|
|
||||||
> = ({ signal }) => apiCommerceProductsRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceProductsRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceProductsRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceProductsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceProductsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Retrieve product (public)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceProductsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceProductsRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceProductsRetrieveQueryOptions = <
|
export const getApiCommerceProductsRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiCommerceProductsRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -75,202 +71,12 @@ export const apiCommerceRefundsList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceRefundsListInfiniteQueryKey = (
|
|
||||||
params?: ApiCommerceRefundsListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/commerce/refunds/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceRefundsListQueryKey = (
|
export const getApiCommerceRefundsListQueryKey = (
|
||||||
params?: ApiCommerceRefundsListParams,
|
params?: ApiCommerceRefundsListParams,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/commerce/refunds/`, ...(params ? [params] : [])] as const;
|
return [`/api/commerce/refunds/`, ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceRefundsListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceRefundsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiCommerceRefundsListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiCommerceRefundsList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceRefundsListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceRefundsListInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceRefundsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiCommerceRefundsListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceRefundsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceRefundsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceRefundsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceRefundsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List refunds (admin)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceRefundsListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
params?: ApiCommerceRefundsListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiCommerceRefundsListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceRefundsListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceRefundsListQueryOptions = <
|
export const getApiCommerceRefundsListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
TData = Awaited<ReturnType<typeof apiCommerceRefundsList>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -510,164 +316,10 @@ export const apiCommerceRefundsRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceRefundsRetrieveInfiniteQueryKey = (id?: number) => {
|
|
||||||
return ["infinite", `/api/commerce/refunds/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiCommerceRefundsRetrieveQueryKey = (id?: number) => {
|
export const getApiCommerceRefundsRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/commerce/refunds/${id}/`] as const;
|
return [`/api/commerce/refunds/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiCommerceRefundsRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiCommerceRefundsRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>
|
|
||||||
> = ({ signal }) => apiCommerceRefundsRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiCommerceRefundsRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiCommerceRefundsRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiCommerceRefundsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceRefundsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiCommerceRefundsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Retrieve refund (admin)
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiCommerceRefundsRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiCommerceRefundsRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiCommerceRefundsRetrieveQueryOptions = <
|
export const getApiCommerceRefundsRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiCommerceRefundsRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,19 +3,15 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
UseQueryResult,
|
UseQueryResult,
|
||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
@@ -33,161 +29,10 @@ export const apiTrading212EquityCashRetrieve = (signal?: AbortSignal) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiTrading212EquityCashRetrieveInfiniteQueryKey = () => {
|
|
||||||
return ["infinite", `/api/trading212/equity/cash/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiTrading212EquityCashRetrieveQueryKey = () => {
|
export const getApiTrading212EquityCashRetrieveQueryKey = () => {
|
||||||
return [`/api/trading212/equity/cash/`] as const;
|
return [`/api/trading212/equity/cash/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiTrading212EquityCashRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
}) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiTrading212EquityCashRetrieveInfiniteQueryKey();
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
> = ({ signal }) => apiTrading212EquityCashRetrieve(signal);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiTrading212EquityCashRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiTrading212EquityCashRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiTrading212EquityCashRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiTrading212EquityCashRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiTrading212EquityCashRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Get Trading212 account cash
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiTrading212EquityCashRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions =
|
|
||||||
getApiTrading212EquityCashRetrieveInfiniteQueryOptions(options);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiTrading212EquityCashRetrieveQueryOptions = <
|
export const getApiTrading212EquityCashRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiTrading212EquityCashRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
@@ -332,161 +177,10 @@ export const apiTrading212EquitySummaryRetrieve = (signal?: AbortSignal) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiTrading212EquitySummaryRetrieveInfiniteQueryKey = () => {
|
|
||||||
return ["infinite", `/api/trading212/equity/summary/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiTrading212EquitySummaryRetrieveQueryKey = () => {
|
export const getApiTrading212EquitySummaryRetrieveQueryKey = () => {
|
||||||
return [`/api/trading212/equity/summary/`] as const;
|
return [`/api/trading212/equity/summary/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiTrading212EquitySummaryRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
}) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ??
|
|
||||||
getApiTrading212EquitySummaryRetrieveInfiniteQueryKey();
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
> = ({ signal }) => apiTrading212EquitySummaryRetrieve(signal);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiTrading212EquitySummaryRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiTrading212EquitySummaryRetrieveInfiniteQueryError = unknown;
|
|
||||||
|
|
||||||
export function useApiTrading212EquitySummaryRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiTrading212EquitySummaryRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiTrading212EquitySummaryRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Get Trading212 account summary
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiTrading212EquitySummaryRetrieveInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>
|
|
||||||
>,
|
|
||||||
TError = unknown,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions =
|
|
||||||
getApiTrading212EquitySummaryRetrieveInfiniteQueryOptions(options);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiTrading212EquitySummaryRetrieveQueryOptions = <
|
export const getApiTrading212EquitySummaryRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiTrading212EquitySummaryRetrieve>>,
|
||||||
TError = unknown,
|
TError = unknown,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -126,13 +122,6 @@ export const apiAccountVerifyEmailRetrieve = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountVerifyEmailRetrieveInfiniteQueryKey = (
|
|
||||||
uidb64?: string,
|
|
||||||
token?: string,
|
|
||||||
) => {
|
|
||||||
return ["infinite", `/api/account/verify-email/${uidb64}/${token}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
||||||
uidb64?: string,
|
uidb64?: string,
|
||||||
token?: string,
|
token?: string,
|
||||||
@@ -140,173 +129,6 @@ export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
|||||||
return [`/api/account/verify-email/${uidb64}/${token}/`] as const;
|
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 = <
|
export const getApiAccountVerifyEmailRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||||
TError = void,
|
TError = void,
|
||||||
|
|||||||
@@ -3,20 +3,16 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* OpenAPI spec version: 0.0.0
|
* OpenAPI spec version: 0.0.0
|
||||||
*/
|
*/
|
||||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type {
|
import type {
|
||||||
DataTag,
|
DataTag,
|
||||||
DefinedInitialDataOptions,
|
DefinedInitialDataOptions,
|
||||||
DefinedUseInfiniteQueryResult,
|
|
||||||
DefinedUseQueryResult,
|
DefinedUseQueryResult,
|
||||||
InfiniteData,
|
|
||||||
MutationFunction,
|
MutationFunction,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryFunction,
|
QueryFunction,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UndefinedInitialDataOptions,
|
UndefinedInitialDataOptions,
|
||||||
UseInfiniteQueryOptions,
|
|
||||||
UseInfiniteQueryResult,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
UseMutationResult,
|
UseMutationResult,
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
@@ -72,149 +68,10 @@ export const apiAccountUserMeRetrieve = (signal?: AbortSignal) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountUserMeRetrieveInfiniteQueryKey = () => {
|
|
||||||
return ["infinite", `/api/account/user/me/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiAccountUserMeRetrieveQueryKey = () => {
|
export const getApiAccountUserMeRetrieveQueryKey = () => {
|
||||||
return [`/api/account/user/me/`] as const;
|
return [`/api/account/user/me/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountUserMeRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
}) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiAccountUserMeRetrieveInfiniteQueryKey();
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>
|
|
||||||
> = ({ signal }) => apiAccountUserMeRetrieve(signal);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiAccountUserMeRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiAccountUserMeRetrieveInfiniteQueryError = void;
|
|
||||||
|
|
||||||
export function useApiAccountUserMeRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiAccountUserMeRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiAccountUserMeRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary Get current authenticated user
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiAccountUserMeRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiAccountUserMeRetrieveInfiniteQueryOptions(options);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiAccountUserMeRetrieveQueryOptions = <
|
export const getApiAccountUserMeRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiAccountUserMeRetrieve>>,
|
||||||
TError = void,
|
TError = void,
|
||||||
@@ -364,202 +221,12 @@ export const apiAccountUsersList = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountUsersListInfiniteQueryKey = (
|
|
||||||
params?: ApiAccountUsersListParams,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"infinite",
|
|
||||||
`/api/account/users/`,
|
|
||||||
...(params ? [params] : []),
|
|
||||||
] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiAccountUsersListQueryKey = (
|
export const getApiAccountUsersListQueryKey = (
|
||||||
params?: ApiAccountUsersListParams,
|
params?: ApiAccountUsersListParams,
|
||||||
) => {
|
) => {
|
||||||
return [`/api/account/users/`, ...(params ? [params] : [])] as const;
|
return [`/api/account/users/`, ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountUsersListInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
params?: ApiAccountUsersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiAccountUsersListInfiniteQueryKey(params);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
> = ({ signal, pageParam }) =>
|
|
||||||
apiAccountUsersList(
|
|
||||||
{ ...params, page: pageParam || params?.["page"] },
|
|
||||||
signal,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiAccountUsersListInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>
|
|
||||||
>;
|
|
||||||
export type ApiAccountUsersListInfiniteQueryError = void;
|
|
||||||
|
|
||||||
export function useApiAccountUsersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
params: undefined | ApiAccountUsersListParams,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiAccountUsersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
params?: ApiAccountUsersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
QueryKey
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiAccountUsersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
params?: ApiAccountUsersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List, retrieve, update, and delete users.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiAccountUsersListInfinite<
|
|
||||||
TData = InfiniteData<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
params?: ApiAccountUsersListParams,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersList>>,
|
|
||||||
TError,
|
|
||||||
TData,
|
|
||||||
QueryKey,
|
|
||||||
ApiAccountUsersListParams["page"]
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiAccountUsersListInfiniteQueryOptions(
|
|
||||||
params,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiAccountUsersListQueryOptions = <
|
export const getApiAccountUsersListQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiAccountUsersList>>,
|
TData = Awaited<ReturnType<typeof apiAccountUsersList>>,
|
||||||
TError = void,
|
TError = void,
|
||||||
@@ -795,164 +462,10 @@ export const apiAccountUsersRetrieve = (id: number, signal?: AbortSignal) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountUsersRetrieveInfiniteQueryKey = (id?: number) => {
|
|
||||||
return ["infinite", `/api/account/users/${id}/`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getApiAccountUsersRetrieveQueryKey = (id?: number) => {
|
export const getApiAccountUsersRetrieveQueryKey = (id?: number) => {
|
||||||
return [`/api/account/users/${id}/`] as const;
|
return [`/api/account/users/${id}/`] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApiAccountUsersRetrieveInfiniteQueryOptions = <
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUsersRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getApiAccountUsersRetrieveInfiniteQueryKey(id);
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>
|
|
||||||
> = ({ signal }) => apiAccountUsersRetrieve(id, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!id,
|
|
||||||
...queryOptions,
|
|
||||||
} as UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ApiAccountUsersRetrieveInfiniteQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>
|
|
||||||
>;
|
|
||||||
export type ApiAccountUsersRetrieveInfiniteQueryError = void;
|
|
||||||
|
|
||||||
export function useApiAccountUsersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUsersRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options: {
|
|
||||||
query: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
DefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiAccountUsersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUsersRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
Pick<
|
|
||||||
UndefinedInitialDataOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>
|
|
||||||
>,
|
|
||||||
"initialData"
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
export function useApiAccountUsersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUsersRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @summary List, retrieve, update, and delete users.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useApiAccountUsersRetrieveInfinite<
|
|
||||||
TData = InfiniteData<Awaited<ReturnType<typeof apiAccountUsersRetrieve>>>,
|
|
||||||
TError = void,
|
|
||||||
>(
|
|
||||||
id: number,
|
|
||||||
options?: {
|
|
||||||
query?: Partial<
|
|
||||||
UseInfiniteQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
queryClient?: QueryClient,
|
|
||||||
): UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
} {
|
|
||||||
const queryOptions = getApiAccountUsersRetrieveInfiniteQueryOptions(
|
|
||||||
id,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const query = useInfiniteQuery(
|
|
||||||
queryOptions,
|
|
||||||
queryClient,
|
|
||||||
) as UseInfiniteQueryResult<TData, TError> & {
|
|
||||||
queryKey: DataTag<QueryKey, TData, TError>;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getApiAccountUsersRetrieveQueryOptions = <
|
export const getApiAccountUsersRetrieveQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
TData = Awaited<ReturnType<typeof apiAccountUsersRetrieve>>,
|
||||||
TError = void,
|
TError = void,
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import axios, { type AxiosRequestConfig } from "axios";
|
import axios, { type AxiosRequestConfig } from "axios";
|
||||||
|
|
||||||
|
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:8000";
|
||||||
|
|
||||||
|
|
||||||
// použij tohle pro API vyžadující autentizaci
|
// použij tohle pro API vyžadující autentizaci
|
||||||
export const privateApi = axios.create({
|
export const privateApi = axios.create({
|
||||||
baseURL: "/api/",
|
baseURL: backendUrl,
|
||||||
withCredentials: true, // potřebuje HttpOnly cookies
|
withCredentials: true, // potřebuje HttpOnly cookies
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import axios, { type AxiosRequestConfig } from "axios";
|
import axios, { type AxiosRequestConfig } from "axios";
|
||||||
|
|
||||||
|
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:8000";
|
||||||
|
|
||||||
|
|
||||||
// použij tohle pro veřejné API nevyžadující autentizaci
|
// použij tohle pro veřejné API nevyžadující autentizaci
|
||||||
export const publicApi = axios.create({
|
export const publicApi = axios.create({
|
||||||
baseURL: "/api/",
|
baseURL: backendUrl,
|
||||||
withCredentials: false, // veřejné API NEPOSÍLÁ cookies
|
withCredentials: false, // veřejné API NEPOSÍLÁ cookies
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { defineConfig } from "orval";
|
import { defineConfig } from "orval";
|
||||||
import "dotenv/config";
|
|
||||||
|
|
||||||
const backendUrl = process.env.VITE_BACKEND_URL || "http://localhost:8000";
|
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:8000";
|
||||||
|
|
||||||
// může se hodit pokud nechceme při buildu generovat klienta (nechat false pro produkci nebo vynechat)
|
// může se hodit pokud nechceme při buildu generovat klienta (nechat false pro produkci nebo vynechat)
|
||||||
const SKIP_ORVAL = process.env.SKIP_ORVAL === "true";
|
const SKIP_ORVAL = process.env.SKIP_ORVAL === "true";
|
||||||
|
|||||||
@@ -1,25 +1,36 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useApiDownloaderDownloadRetrieve } from '@/api/generated/public/downloader';
|
import { apiDownloaderDownloadRetrieve, apiDownloaderDownloadCreate } from '@/api/generated/public/downloader';
|
||||||
|
import { type VideoInfoResponse } from '@/api/generated/public/models';
|
||||||
|
|
||||||
|
|
||||||
export default function Downloader() {
|
export default function Downloader() {
|
||||||
const [videoUrl, setVideoUrl] = useState('');
|
const [videoUrl, setVideoUrl] = useState('');
|
||||||
|
const [videoInfo, setVideoInfo] = useState<null | VideoInfoResponse>(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [error, setError] = useState<null | { error: string }>(null);
|
||||||
|
|
||||||
// The hook needs: (params, options)
|
async function retriveVideoInfo() {
|
||||||
// params = { url: string }
|
setIsLoading(true);
|
||||||
// options = { query: { enabled: boolean } }
|
setError(null);
|
||||||
const { data: videoInfo, isLoading, error } = useApiDownloaderDownloadRetrieve(
|
try {
|
||||||
{ url: videoUrl }, // 1st arg: parameters
|
const info = await apiDownloaderDownloadRetrieve({ url: videoUrl });
|
||||||
{
|
setVideoInfo(info);
|
||||||
query: {
|
} catch (err: any) {
|
||||||
enabled: videoUrl.length > 10, // 2nd arg: query options (only fetch when URL is valid)
|
setError({ error: err.message || 'Failed to retrieve video info' });
|
||||||
}
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
console.log('Retrieving video info for URL:', videoUrl);
|
||||||
|
console.log('Retrieved video info:', videoInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-6">
|
<div className="p-6">
|
||||||
<h1 className="text-2xl font-bold mb-4">Video Downloader</h1>
|
<h1 className="text-2xl font-bold mb-4">Video Downloader</h1>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={videoUrl}
|
value={videoUrl}
|
||||||
@@ -28,6 +39,8 @@ export default function Downloader() {
|
|||||||
className="w-full p-2 border rounded mb-4"
|
className="w-full p-2 border rounded mb-4"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<button onClick={retriveVideoInfo}>Retrieve options</button>
|
||||||
|
|
||||||
{isLoading && <p>Loading video info...</p>}
|
{isLoading && <p>Loading video info...</p>}
|
||||||
|
|
||||||
{error && <p className="text-red-500">Error: {error?.error}</p>}
|
{error && <p className="text-red-500">Error: {error?.error}</p>}
|
||||||
|
|||||||
Reference in New Issue
Block a user