- 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.
286 lines
7.2 KiB
TypeScript
286 lines
7.2 KiB
TypeScript
/**
|
|
* Generated by orval v7.17.0 🍺
|
|
* Do not edit manually.
|
|
* OpenAPI spec version: 0.0.0
|
|
*/
|
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
import type {
|
|
DataTag,
|
|
DefinedInitialDataOptions,
|
|
DefinedUseQueryResult,
|
|
MutationFunction,
|
|
QueryClient,
|
|
QueryFunction,
|
|
QueryKey,
|
|
UndefinedInitialDataOptions,
|
|
UseMutationOptions,
|
|
UseMutationResult,
|
|
UseQueryOptions,
|
|
UseQueryResult,
|
|
} from "@tanstack/react-query";
|
|
|
|
import type { UserRegistration } from ".././models";
|
|
|
|
import { privateMutator } from "../../../privateClient";
|
|
|
|
/**
|
|
* Register a new user (company or individual). The user will receive an email with a verification link.
|
|
* @summary Register a new user (company or individual)
|
|
*/
|
|
export const apiAccountRegisterCreate = (
|
|
userRegistration: UserRegistration,
|
|
signal?: AbortSignal,
|
|
) => {
|
|
return privateMutator<UserRegistration>({
|
|
url: `/api/account/register/`,
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
data: userRegistration,
|
|
signal,
|
|
});
|
|
};
|
|
|
|
export const getApiAccountRegisterCreateMutationOptions = <
|
|
TError = void,
|
|
TContext = unknown,
|
|
>(options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
|
TError,
|
|
{ data: UserRegistration },
|
|
TContext
|
|
>;
|
|
}): UseMutationOptions<
|
|
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
|
TError,
|
|
{ data: UserRegistration },
|
|
TContext
|
|
> => {
|
|
const mutationKey = ["apiAccountRegisterCreate"];
|
|
const { mutation: mutationOptions } = options
|
|
? options.mutation &&
|
|
"mutationKey" in options.mutation &&
|
|
options.mutation.mutationKey
|
|
? options
|
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
: { mutation: { mutationKey } };
|
|
|
|
const mutationFn: MutationFunction<
|
|
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
|
{ data: UserRegistration }
|
|
> = (props) => {
|
|
const { data } = props ?? {};
|
|
|
|
return apiAccountRegisterCreate(data);
|
|
};
|
|
|
|
return { mutationFn, ...mutationOptions };
|
|
};
|
|
|
|
export type ApiAccountRegisterCreateMutationResult = NonNullable<
|
|
Awaited<ReturnType<typeof apiAccountRegisterCreate>>
|
|
>;
|
|
export type ApiAccountRegisterCreateMutationBody = UserRegistration;
|
|
export type ApiAccountRegisterCreateMutationError = void;
|
|
|
|
/**
|
|
* @summary Register a new user (company or individual)
|
|
*/
|
|
export const useApiAccountRegisterCreate = <TError = void, TContext = unknown>(
|
|
options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
|
TError,
|
|
{ data: UserRegistration },
|
|
TContext
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseMutationResult<
|
|
Awaited<ReturnType<typeof apiAccountRegisterCreate>>,
|
|
TError,
|
|
{ data: UserRegistration },
|
|
TContext
|
|
> => {
|
|
const mutationOptions = getApiAccountRegisterCreateMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
};
|
|
/**
|
|
* Verify user email using the link with uid and token.
|
|
* @summary Verify user email via link
|
|
*/
|
|
export const apiAccountVerifyEmailRetrieve = (
|
|
uidb64: string,
|
|
token: string,
|
|
signal?: AbortSignal,
|
|
) => {
|
|
return privateMutator<void>({
|
|
url: `/api/account/verify-email/${uidb64}/${token}/`,
|
|
method: "GET",
|
|
signal,
|
|
});
|
|
};
|
|
|
|
export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
|
uidb64?: string,
|
|
token?: string,
|
|
) => {
|
|
return [`/api/account/verify-email/${uidb64}/${token}/`] as const;
|
|
};
|
|
|
|
export const getApiAccountVerifyEmailRetrieveQueryOptions = <
|
|
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError = void,
|
|
>(
|
|
uidb64: string,
|
|
token: string,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
>;
|
|
},
|
|
) => {
|
|
const { query: queryOptions } = options ?? {};
|
|
|
|
const queryKey =
|
|
queryOptions?.queryKey ??
|
|
getApiAccountVerifyEmailRetrieveQueryKey(uidb64, token);
|
|
|
|
const queryFn: QueryFunction<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
|
> = ({ signal }) => apiAccountVerifyEmailRetrieve(uidb64, token, signal);
|
|
|
|
return {
|
|
queryKey,
|
|
queryFn,
|
|
enabled: !!(uidb64 && token),
|
|
...queryOptions,
|
|
} as UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
TData
|
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
};
|
|
|
|
export type ApiAccountVerifyEmailRetrieveQueryResult = NonNullable<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
|
>;
|
|
export type ApiAccountVerifyEmailRetrieveQueryError = void;
|
|
|
|
export function useApiAccountVerifyEmailRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError = void,
|
|
>(
|
|
uidb64: string,
|
|
token: string,
|
|
options: {
|
|
query: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
> &
|
|
Pick<
|
|
DefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
|
>,
|
|
"initialData"
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): DefinedUseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
export function useApiAccountVerifyEmailRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError = void,
|
|
>(
|
|
uidb64: string,
|
|
token: string,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
> &
|
|
Pick<
|
|
UndefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
|
>,
|
|
"initialData"
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
export function useApiAccountVerifyEmailRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError = void,
|
|
>(
|
|
uidb64: string,
|
|
token: string,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
/**
|
|
* @summary Verify user email via link
|
|
*/
|
|
|
|
export function useApiAccountVerifyEmailRetrieve<
|
|
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError = void,
|
|
>(
|
|
uidb64: string,
|
|
token: string,
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<
|
|
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
|
TError,
|
|
TData
|
|
>
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
} {
|
|
const queryOptions = getApiAccountVerifyEmailRetrieveQueryOptions(
|
|
uidb64,
|
|
token,
|
|
options,
|
|
);
|
|
|
|
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
|
TData,
|
|
TError
|
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
|
|
query.queryKey = queryOptions.queryKey;
|
|
|
|
return query;
|
|
}
|