refactor #16

Merged
rov merged 1 commits from refactor into main 2026-03-18 17:04:32 -03:00
23 changed files with 1452 additions and 1460 deletions

View File

@ -1,2 +1,2 @@
VITE_API_BASE_URL=http://localhost:8080
VITE_OMV_BASE_URL=http://omv.badger-pirarucu.ts.net:9000/mangamochi
VITE_OMV_BASE_URL=http://omv.badger-pirarucu.ts.net:9000/mangamochi-dev

View File

@ -4,6 +4,12 @@
* OpenAPI definition
* OpenAPI spec version: v0
*/
export interface RegistrationRequestDTO {
name?: string;
email?: string;
password?: string;
}
export interface DefaultResponseDTOVoid {
timestamp?: string;
data?: unknown;
@ -26,14 +32,9 @@ export interface ImportMangaResponseDTO {
id: number;
}
export interface RegistrationRequestDTO {
name?: string;
email?: string;
password?: string;
}
export interface RefreshTokenRequestDTO {
refreshToken: string;
export interface AuthenticationRequestDTO {
email: string;
password: string;
}
export type AuthenticationResponseDTORole = typeof AuthenticationResponseDTORole[keyof typeof AuthenticationResponseDTORole];
@ -59,24 +60,62 @@ export interface DefaultResponseDTOAuthenticationResponseDTO {
message?: string;
}
export interface AuthenticationRequestDTO {
email: string;
password: string;
export interface RefreshTokenRequestDTO {
refreshToken: string;
}
export interface DefaultResponseDTOProviderListDTO {
timestamp?: string;
data?: ProviderListDTO;
message?: string;
}
export interface ProviderDTO {
id: number;
export interface ContentProviderDTO {
id?: number;
/** @minLength 1 */
name: string;
}
export interface ProviderListDTO {
providers: ProviderDTO[];
export interface ContentProviderListDTO {
providers: ContentProviderDTO[];
}
export interface DefaultResponseDTOContentProviderListDTO {
timestamp?: string;
data?: ContentProviderListDTO;
message?: string;
}
export interface DefaultResponseDTOListMangaContentDTO {
timestamp?: string;
data?: MangaContentDTO[];
message?: string;
}
export interface LanguageDTO {
id: number;
/** @minLength 1 */
code: string;
/** @minLength 1 */
name: string;
}
export interface MangaContentDTO {
id: number;
/** @minLength 1 */
title: string;
downloaded: boolean;
isRead: boolean;
language?: LanguageDTO;
}
export interface DefaultResponseDTOMangaContentImagesDTO {
timestamp?: string;
data?: MangaContentImagesDTO;
message?: string;
}
export interface MangaContentImagesDTO {
id: number;
/** @minLength 1 */
mangaTitle: string;
previousContentId?: number;
nextContentId?: number;
contentImageKeys: string[];
}
export interface DefaultResponseDTOPageMangaListDTO {
@ -85,12 +124,24 @@ export interface DefaultResponseDTOPageMangaListDTO {
message?: string;
}
export type MangaListDTOStatus = typeof MangaListDTOStatus[keyof typeof MangaListDTOStatus];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const MangaListDTOStatus = {
ONGOING: 'ONGOING',
COMPLETED: 'COMPLETED',
HIATUS: 'HIATUS',
CANCELLED: 'CANCELLED',
UNKNOWN: 'UNKNOWN',
} as const;
export interface MangaListDTO {
id: number;
/** @minLength 1 */
title: string;
coverImageKey?: string;
status?: string;
status?: MangaListDTOStatus;
publishedFrom?: string;
publishedTo?: string;
providerCount?: number;
@ -115,9 +166,9 @@ export interface PageMangaListDTO {
}
export interface PageableObject {
paged?: boolean;
pageNumber?: number;
pageSize?: number;
paged?: boolean;
unpaged?: boolean;
offset?: number;
sort?: SortObject;
@ -129,41 +180,30 @@ export interface SortObject {
empty?: boolean;
}
export interface DefaultResponseDTOListMangaChapterDTO {
timestamp?: string;
data?: MangaChapterDTO[];
message?: string;
}
export interface LanguageDTO {
id: number;
/** @minLength 1 */
code: string;
/** @minLength 1 */
name: string;
}
export interface MangaChapterDTO {
id: number;
/** @minLength 1 */
title: string;
downloaded: boolean;
isRead: boolean;
language?: LanguageDTO;
}
export interface DefaultResponseDTOMangaDTO {
timestamp?: string;
data?: MangaDTO;
message?: string;
}
export type MangaDTOStatus = typeof MangaDTOStatus[keyof typeof MangaDTOStatus];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const MangaDTOStatus = {
ONGOING: 'ONGOING',
COMPLETED: 'COMPLETED',
HIATUS: 'HIATUS',
CANCELLED: 'CANCELLED',
UNKNOWN: 'UNKNOWN',
} as const;
export interface MangaDTO {
id: number;
/** @minLength 1 */
title: string;
coverImageKey?: string;
status?: string;
status?: MangaDTOStatus;
publishedFrom?: string;
publishedTo?: string;
synopsis?: string;
@ -178,52 +218,28 @@ export interface MangaDTO {
following: boolean;
}
export type MangaProviderDTOProviderStatus = typeof MangaProviderDTOProviderStatus[keyof typeof MangaProviderDTOProviderStatus];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const MangaProviderDTOProviderStatus = {
ACTIVE: 'ACTIVE',
INACTIVE: 'INACTIVE',
} as const;
export interface MangaProviderDTO {
id: number;
id?: number;
/** @minLength 1 */
providerName: string;
providerStatus: MangaProviderDTOProviderStatus;
active?: boolean;
chaptersAvailable: number;
chaptersDownloaded: number;
supportsChapterFetch: boolean;
}
export interface DefaultResponseDTOMangaChapterImagesDTO {
export interface DefaultResponseDTOListMangaIngestReviewDTO {
timestamp?: string;
data?: MangaChapterImagesDTO;
data?: MangaIngestReviewDTO[];
message?: string;
}
export interface MangaChapterImagesDTO {
id: number;
/** @minLength 1 */
mangaTitle: string;
previousChapterId?: number;
nextChapterId?: number;
chapterImageKeys: string[];
}
export interface DefaultResponseDTOListImportReviewDTO {
timestamp?: string;
data?: ImportReviewDTO[];
message?: string;
}
export interface ImportReviewDTO {
export interface MangaIngestReviewDTO {
id: number;
/** @minLength 1 */
title: string;
/** @minLength 1 */
providerName: string;
contentProviderName: string;
externalUrl?: string;
/** @minLength 1 */
reason: string;
@ -262,16 +278,12 @@ export type ImportMultipleFilesBody = {
files: Blob[];
};
export type ResolveImportReviewParams = {
importReviewId: number;
export type ResolveMangaIngestReviewParams = {
id: number;
malId: string;
};
export type UpdateProviderMangaListParams = {
providerId: number;
};
export type GetProvidersParams = {
export type GetContentProvidersParams = {
manualImport?: boolean;
};

View File

@ -17,9 +17,7 @@ import type {
import type {
AuthenticationRequestDTO,
DefaultResponseDTOAuthenticationResponseDTO,
DefaultResponseDTOVoid,
RefreshTokenRequestDTO,
RegistrationRequestDTO
RefreshTokenRequestDTO
} from '../api.schemas';
import { customInstance } from '../../api';
@ -30,30 +28,30 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Register a new user.
* @summary Register user
* Authenticate an user with email and password.
* @summary Authenticate an user
*/
export const registerUser = (
registrationRequestDTO: RegistrationRequestDTO,
export const login = (
authenticationRequestDTO: AuthenticationRequestDTO,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/auth/register`, method: 'POST',
return customInstance<DefaultResponseDTOAuthenticationResponseDTO>(
{url: `/authentication`, method: 'POST',
headers: {'Content-Type': 'application/json', },
data: registrationRequestDTO, signal
data: authenticationRequestDTO, signal
},
options);
}
export const getRegisterUserMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof registerUser>>, TError,{data: RegistrationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof registerUser>>, TError,{data: RegistrationRequestDTO}, TContext> => {
export const getLoginMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof login>>, TError,{data: AuthenticationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof login>>, TError,{data: AuthenticationRequestDTO}, TContext> => {
const mutationKey = ['registerUser'];
const mutationKey = ['login'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
@ -63,10 +61,10 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof registerUser>>, {data: RegistrationRequestDTO}> = (props) => {
const mutationFn: MutationFunction<Awaited<ReturnType<typeof login>>, {data: AuthenticationRequestDTO}> = (props) => {
const {data} = props ?? {};
return registerUser(data,requestOptions)
return login(data,requestOptions)
}
@ -74,23 +72,23 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
return { mutationFn, ...mutationOptions }}
export type RegisterUserMutationResult = NonNullable<Awaited<ReturnType<typeof registerUser>>>
export type RegisterUserMutationBody = RegistrationRequestDTO
export type RegisterUserMutationError = unknown
export type LoginMutationResult = NonNullable<Awaited<ReturnType<typeof login>>>
export type LoginMutationBody = AuthenticationRequestDTO
export type LoginMutationError = unknown
/**
* @summary Register user
* @summary Authenticate an user
*/
export const useRegisterUser = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof registerUser>>, TError,{data: RegistrationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
export const useLogin = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof login>>, TError,{data: AuthenticationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof registerUser>>,
Awaited<ReturnType<typeof login>>,
TError,
{data: RegistrationRequestDTO},
{data: AuthenticationRequestDTO},
TContext
> => {
const mutationOptions = getRegisterUserMutationOptions(options);
const mutationOptions = getLoginMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
@ -105,7 +103,7 @@ export const refreshAuthToken = (
return customInstance<DefaultResponseDTOAuthenticationResponseDTO>(
{url: `/auth/refresh`, method: 'POST',
{url: `/authentication/refresh`, method: 'POST',
headers: {'Content-Type': 'application/json', },
data: refreshTokenRequestDTO, signal
},
@ -159,69 +157,4 @@ export const useRefreshAuthToken = <TError = unknown,
return useMutation(mutationOptions, queryClient);
}
/**
* Authenticate user with email and password.
* @summary Authenticate user
*/
export const authenticateUser = (
authenticationRequestDTO: AuthenticationRequestDTO,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOAuthenticationResponseDTO>(
{url: `/auth/login`, method: 'POST',
headers: {'Content-Type': 'application/json', },
data: authenticationRequestDTO, signal
},
options);
}
export const getAuthenticateUserMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authenticateUser>>, TError,{data: AuthenticationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof authenticateUser>>, TError,{data: AuthenticationRequestDTO}, TContext> => {
const mutationKey = ['authenticateUser'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof authenticateUser>>, {data: AuthenticationRequestDTO}> = (props) => {
const {data} = props ?? {};
return authenticateUser(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type AuthenticateUserMutationResult = NonNullable<Awaited<ReturnType<typeof authenticateUser>>>
export type AuthenticateUserMutationBody = AuthenticationRequestDTO
export type AuthenticateUserMutationError = unknown
/**
* @summary Authenticate user
*/
export const useAuthenticateUser = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authenticateUser>>, TError,{data: AuthenticationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof authenticateUser>>,
TError,
{data: AuthenticationRequestDTO},
TContext
> => {
const mutationOptions = getAuthenticateUserMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}

View File

@ -0,0 +1,315 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
import {
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOListGenreDTO,
DefaultResponseDTOMangaDTO,
DefaultResponseDTOPageMangaListDTO,
GetMangasParams
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Retrieve a list of mangas with their details.
* @summary Get a list of mangas
*/
export const getMangas = (
params?: GetMangasParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOPageMangaListDTO>(
{url: `/catalog/mangas`, method: 'GET',
params, signal
},
options);
}
export const getGetMangasQueryKey = (params?: GetMangasParams,) => {
return [
`/catalog/mangas`, ...(params ? [params]: [])
] as const;
}
export const getGetMangasQueryOptions = <TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangasQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangas>>> = ({ signal }) => getMangas(params, requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangasQueryResult = NonNullable<Awaited<ReturnType<typeof getMangas>>>
export type GetMangasQueryError = unknown
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params: undefined | GetMangasParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangas>>,
TError,
Awaited<ReturnType<typeof getMangas>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangas>>,
TError,
Awaited<ReturnType<typeof getMangas>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get a list of mangas
*/
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangasQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Get the details of a manga by its ID
* @summary Get the details of a manga
*/
export const getManga = (
mangaId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOMangaDTO>(
{url: `/catalog/mangas/${encodeURIComponent(String(mangaId))}`, method: 'GET', signal
},
options);
}
export const getGetMangaQueryKey = (mangaId?: number,) => {
return [
`/catalog/mangas/${mangaId}`
] as const;
}
export const getGetMangaQueryOptions = <TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaQueryKey(mangaId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getManga>>> = ({ signal }) => getManga(mangaId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(mangaId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaQueryResult = NonNullable<Awaited<ReturnType<typeof getManga>>>
export type GetMangaQueryError = unknown
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getManga>>,
TError,
Awaited<ReturnType<typeof getManga>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getManga>>,
TError,
Awaited<ReturnType<typeof getManga>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get the details of a manga
*/
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaQueryOptions(mangaId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Retrieve a list of manga genres.
* @summary Get a list of manga genres
*/
export const getGenres = (
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOListGenreDTO>(
{url: `/catalog/genres`, method: 'GET', signal
},
options);
}
export const getGetGenresQueryKey = () => {
return [
`/catalog/genres`
] as const;
}
export const getGetGenresQueryOptions = <TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetGenresQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getGenres>>> = ({ signal }) => getGenres(requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetGenresQueryResult = NonNullable<Awaited<ReturnType<typeof getGenres>>>
export type GetGenresQueryError = unknown
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getGenres>>,
TError,
Awaited<ReturnType<typeof getGenres>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getGenres>>,
TError,
Awaited<ReturnType<typeof getGenres>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get a list of manga genres
*/
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetGenresQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -0,0 +1,219 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
import {
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOListMangaContentDTO,
DefaultResponseDTOMangaContentImagesDTO
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Retrieve the content for a specific manga/content provider combination.
* @summary Get the content for a specific manga/content provider combination
*/
export const getMangaProviderContent = (
mangaContentProviderId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOListMangaContentDTO>(
{url: `/content/${encodeURIComponent(String(mangaContentProviderId))}`, method: 'GET', signal
},
options);
}
export const getGetMangaProviderContentQueryKey = (mangaContentProviderId?: number,) => {
return [
`/content/${mangaContentProviderId}`
] as const;
}
export const getGetMangaProviderContentQueryOptions = <TData = Awaited<ReturnType<typeof getMangaProviderContent>>, TError = unknown>(mangaContentProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaProviderContent>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaProviderContentQueryKey(mangaContentProviderId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangaProviderContent>>> = ({ signal }) => getMangaProviderContent(mangaContentProviderId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(mangaContentProviderId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangaProviderContent>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaProviderContentQueryResult = NonNullable<Awaited<ReturnType<typeof getMangaProviderContent>>>
export type GetMangaProviderContentQueryError = unknown
export function useGetMangaProviderContent<TData = Awaited<ReturnType<typeof getMangaProviderContent>>, TError = unknown>(
mangaContentProviderId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaProviderContent>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaProviderContent>>,
TError,
Awaited<ReturnType<typeof getMangaProviderContent>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaProviderContent<TData = Awaited<ReturnType<typeof getMangaProviderContent>>, TError = unknown>(
mangaContentProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaProviderContent>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaProviderContent>>,
TError,
Awaited<ReturnType<typeof getMangaProviderContent>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaProviderContent<TData = Awaited<ReturnType<typeof getMangaProviderContent>>, TError = unknown>(
mangaContentProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaProviderContent>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get the content for a specific manga/content provider combination
*/
export function useGetMangaProviderContent<TData = Awaited<ReturnType<typeof getMangaProviderContent>>, TError = unknown>(
mangaContentProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaProviderContent>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaProviderContentQueryOptions(mangaContentProviderId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Retrieve a list of manga content images for a specific manga/provider combination.
* @summary Get the content images for a specific manga/provider combination
*/
export const getMangaContentImages = (
mangaContentId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOMangaContentImagesDTO>(
{url: `/content/${encodeURIComponent(String(mangaContentId))}/images`, method: 'GET', signal
},
options);
}
export const getGetMangaContentImagesQueryKey = (mangaContentId?: number,) => {
return [
`/content/${mangaContentId}/images`
] as const;
}
export const getGetMangaContentImagesQueryOptions = <TData = Awaited<ReturnType<typeof getMangaContentImages>>, TError = unknown>(mangaContentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaContentImages>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaContentImagesQueryKey(mangaContentId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangaContentImages>>> = ({ signal }) => getMangaContentImages(mangaContentId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(mangaContentId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangaContentImages>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaContentImagesQueryResult = NonNullable<Awaited<ReturnType<typeof getMangaContentImages>>>
export type GetMangaContentImagesQueryError = unknown
export function useGetMangaContentImages<TData = Awaited<ReturnType<typeof getMangaContentImages>>, TError = unknown>(
mangaContentId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaContentImages>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaContentImages>>,
TError,
Awaited<ReturnType<typeof getMangaContentImages>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaContentImages<TData = Awaited<ReturnType<typeof getMangaContentImages>>, TError = unknown>(
mangaContentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaContentImages>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaContentImages>>,
TError,
Awaited<ReturnType<typeof getMangaContentImages>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaContentImages<TData = Awaited<ReturnType<typeof getMangaContentImages>>, TError = unknown>(
mangaContentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaContentImages>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get the content images for a specific manga/provider combination
*/
export function useGetMangaContentImages<TData = Awaited<ReturnType<typeof getMangaContentImages>>, TError = unknown>(
mangaContentId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaContentImages>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaContentImagesQueryOptions(mangaContentId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -1,125 +0,0 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
import {
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOListGenreDTO
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Retrieve a list of genres.
* @summary Get a list of genres
*/
export const getGenres = (
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOListGenreDTO>(
{url: `/genres`, method: 'GET', signal
},
options);
}
export const getGetGenresQueryKey = () => {
return [
`/genres`
] as const;
}
export const getGetGenresQueryOptions = <TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetGenresQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getGenres>>> = ({ signal }) => getGenres(requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetGenresQueryResult = NonNullable<Awaited<ReturnType<typeof getGenres>>>
export type GetGenresQueryError = unknown
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getGenres>>,
TError,
Awaited<ReturnType<typeof getGenres>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getGenres>>,
TError,
Awaited<ReturnType<typeof getGenres>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get a list of genres
*/
export function useGetGenres<TData = Awaited<ReturnType<typeof getGenres>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getGenres>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetGenresQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -0,0 +1,384 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
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 {
DefaultResponseDTOContentProviderListDTO,
DefaultResponseDTOVoid,
GetContentProvidersParams
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Triggers the ingestion process for a specific content provider, fetching manga data and queuing it for processing.
* @summary Fetch mangas from a content provider
*/
export const fetchContentProviderMangas = (
providerId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/ingestion/providers/${encodeURIComponent(String(providerId))}/fetch`, method: 'POST', signal
},
options);
}
export const getFetchContentProviderMangasMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderMangas>>, TError,{providerId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderMangas>>, TError,{providerId: number}, TContext> => {
const mutationKey = ['fetchContentProviderMangas'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof fetchContentProviderMangas>>, {providerId: number}> = (props) => {
const {providerId} = props ?? {};
return fetchContentProviderMangas(providerId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FetchContentProviderMangasMutationResult = NonNullable<Awaited<ReturnType<typeof fetchContentProviderMangas>>>
export type FetchContentProviderMangasMutationError = unknown
/**
* @summary Fetch mangas from a content provider
*/
export const useFetchContentProviderMangas = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderMangas>>, TError,{providerId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof fetchContentProviderMangas>>,
TError,
{providerId: number},
TContext
> => {
const mutationOptions = getFetchContentProviderMangasMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Triggers the ingestion process for all content providers, fetching manga data and queuing them for processing.
* @summary Fetch mangas from all content providers
*/
export const fetchAllContentProviderMangas = (
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/ingestion/providers/fetch`, method: 'POST', signal
},
options);
}
export const getFetchAllContentProviderMangasMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchAllContentProviderMangas>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof fetchAllContentProviderMangas>>, TError,void, TContext> => {
const mutationKey = ['fetchAllContentProviderMangas'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof fetchAllContentProviderMangas>>, void> = () => {
return fetchAllContentProviderMangas(requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FetchAllContentProviderMangasMutationResult = NonNullable<Awaited<ReturnType<typeof fetchAllContentProviderMangas>>>
export type FetchAllContentProviderMangasMutationError = unknown
/**
* @summary Fetch mangas from all content providers
*/
export const useFetchAllContentProviderMangas = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchAllContentProviderMangas>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof fetchAllContentProviderMangas>>,
TError,
void,
TContext
> => {
const mutationOptions = getFetchAllContentProviderMangasMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Fetch the content (images) from the content provider
* @summary Fetch content from a content provider
*/
export const fetchContentProviderContent = (
mangaContentId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/ingestion/manga-content/${encodeURIComponent(String(mangaContentId))}/fetch`, method: 'POST', signal
},
options);
}
export const getFetchContentProviderContentMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderContent>>, TError,{mangaContentId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderContent>>, TError,{mangaContentId: number}, TContext> => {
const mutationKey = ['fetchContentProviderContent'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof fetchContentProviderContent>>, {mangaContentId: number}> = (props) => {
const {mangaContentId} = props ?? {};
return fetchContentProviderContent(mangaContentId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FetchContentProviderContentMutationResult = NonNullable<Awaited<ReturnType<typeof fetchContentProviderContent>>>
export type FetchContentProviderContentMutationError = unknown
/**
* @summary Fetch content from a content provider
*/
export const useFetchContentProviderContent = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderContent>>, TError,{mangaContentId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof fetchContentProviderContent>>,
TError,
{mangaContentId: number},
TContext
> => {
const mutationOptions = getFetchContentProviderContentMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Triggers the ingestion process for a specific content provider, fetching content list and queuing it for processing.
* @summary Fetch content list from a content provider
*/
export const fetchContentProviderContentList = (
mangaContentProviderId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/ingestion/manga-content-providers/${encodeURIComponent(String(mangaContentProviderId))}/fetch`, method: 'POST', signal
},
options);
}
export const getFetchContentProviderContentListMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderContentList>>, TError,{mangaContentProviderId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderContentList>>, TError,{mangaContentProviderId: number}, TContext> => {
const mutationKey = ['fetchContentProviderContentList'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof fetchContentProviderContentList>>, {mangaContentProviderId: number}> = (props) => {
const {mangaContentProviderId} = props ?? {};
return fetchContentProviderContentList(mangaContentProviderId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FetchContentProviderContentListMutationResult = NonNullable<Awaited<ReturnType<typeof fetchContentProviderContentList>>>
export type FetchContentProviderContentListMutationError = unknown
/**
* @summary Fetch content list from a content provider
*/
export const useFetchContentProviderContentList = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchContentProviderContentList>>, TError,{mangaContentProviderId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof fetchContentProviderContentList>>,
TError,
{mangaContentProviderId: number},
TContext
> => {
const mutationOptions = getFetchContentProviderContentListMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Retrieve a list of content providers
* @summary Get a list of content providers
*/
export const getContentProviders = (
params?: GetContentProvidersParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOContentProviderListDTO>(
{url: `/ingestion/providers`, method: 'GET',
params, signal
},
options);
}
export const getGetContentProvidersQueryKey = (params?: GetContentProvidersParams,) => {
return [
`/ingestion/providers`, ...(params ? [params]: [])
] as const;
}
export const getGetContentProvidersQueryOptions = <TData = Awaited<ReturnType<typeof getContentProviders>>, TError = unknown>(params?: GetContentProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContentProviders>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetContentProvidersQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getContentProviders>>> = ({ signal }) => getContentProviders(params, requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getContentProviders>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetContentProvidersQueryResult = NonNullable<Awaited<ReturnType<typeof getContentProviders>>>
export type GetContentProvidersQueryError = unknown
export function useGetContentProviders<TData = Awaited<ReturnType<typeof getContentProviders>>, TError = unknown>(
params: undefined | GetContentProvidersParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContentProviders>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getContentProviders>>,
TError,
Awaited<ReturnType<typeof getContentProviders>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContentProviders<TData = Awaited<ReturnType<typeof getContentProviders>>, TError = unknown>(
params?: GetContentProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContentProviders>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getContentProviders>>,
TError,
Awaited<ReturnType<typeof getContentProviders>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContentProviders<TData = Awaited<ReturnType<typeof getContentProviders>>, TError = unknown>(
params?: GetContentProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContentProviders>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get a list of content providers
*/
export function useGetContentProviders<TData = Awaited<ReturnType<typeof getContentProviders>>, TError = unknown>(
params?: GetContentProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContentProviders>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetContentProvidersQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -15,8 +15,7 @@ import type {
} from '@tanstack/react-query';
import type {
DefaultResponseDTOVoid,
UpdateProviderMangaListParams
DefaultResponseDTOVoid
} from '../api.schemas';
import { customInstance } from '../../api';
@ -90,196 +89,6 @@ export const useUserFollowUpdate = <TError = unknown,
return useMutation(mutationOptions, queryClient);
}
/**
* Queue the retrieval of the manga list for a specific provider
* @summary Queue update provider manga list
*/
export const updateProviderMangaList = (
params: UpdateProviderMangaListParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/management/update-provider-manga-list`, method: 'POST',
params, signal
},
options);
}
export const getUpdateProviderMangaListMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProviderMangaList>>, TError,{params: UpdateProviderMangaListParams}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof updateProviderMangaList>>, TError,{params: UpdateProviderMangaListParams}, TContext> => {
const mutationKey = ['updateProviderMangaList'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateProviderMangaList>>, {params: UpdateProviderMangaListParams}> = (props) => {
const {params} = props ?? {};
return updateProviderMangaList(params,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type UpdateProviderMangaListMutationResult = NonNullable<Awaited<ReturnType<typeof updateProviderMangaList>>>
export type UpdateProviderMangaListMutationError = unknown
/**
* @summary Queue update provider manga list
*/
export const useUpdateProviderMangaList = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateProviderMangaList>>, TError,{params: UpdateProviderMangaListParams}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof updateProviderMangaList>>,
TError,
{params: UpdateProviderMangaListParams},
TContext
> => {
const mutationOptions = getUpdateProviderMangaListMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Queue the retrieval of the manga lists from the content providers
* @summary Queue update manga list
*/
export const updateMangaList = (
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/management/update-manga-list`, method: 'POST', signal
},
options);
}
export const getUpdateMangaListMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateMangaList>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof updateMangaList>>, TError,void, TContext> => {
const mutationKey = ['updateMangaList'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateMangaList>>, void> = () => {
return updateMangaList(requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type UpdateMangaListMutationResult = NonNullable<Awaited<ReturnType<typeof updateMangaList>>>
export type UpdateMangaListMutationError = unknown
/**
* @summary Queue update manga list
*/
export const useUpdateMangaList = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateMangaList>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof updateMangaList>>,
TError,
void,
TContext
> => {
const mutationOptions = getUpdateMangaListMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Triggers the update of the metadata for a manga by its ID
* @summary Trigger manga data update
*/
export const triggerUpdateMangaData = (
mangaId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/management/update-manga-data/${encodeURIComponent(String(mangaId))}`, method: 'POST', signal
},
options);
}
export const getTriggerUpdateMangaDataMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof triggerUpdateMangaData>>, TError,{mangaId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof triggerUpdateMangaData>>, TError,{mangaId: number}, TContext> => {
const mutationKey = ['triggerUpdateMangaData'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof triggerUpdateMangaData>>, {mangaId: number}> = (props) => {
const {mangaId} = props ?? {};
return triggerUpdateMangaData(mangaId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type TriggerUpdateMangaDataMutationResult = NonNullable<Awaited<ReturnType<typeof triggerUpdateMangaData>>>
export type TriggerUpdateMangaDataMutationError = unknown
/**
* @summary Trigger manga data update
*/
export const useTriggerUpdateMangaData = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof triggerUpdateMangaData>>, TError,{mangaId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof triggerUpdateMangaData>>,
TError,
{mangaId: number},
TContext
> => {
const mutationOptions = getTriggerUpdateMangaDataMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Sends a test notification to all users
* @summary Test notification
*/

View File

@ -5,26 +5,16 @@
* OpenAPI spec version: v0
*/
import {
useMutation,
useQuery
useMutation
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
UseMutationResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOMangaChapterImagesDTO,
DefaultResponseDTOVoid,
DownloadChapterArchiveParams
} from '../api.schemas';
@ -163,69 +153,6 @@ export const useMarkAsRead = <TError = unknown,
return useMutation(mutationOptions, queryClient);
}
/**
* Fetch the chapter from the provider
* @summary Fetch chapter
*/
export const fetchChapter = (
chapterId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/mangas/chapters/${encodeURIComponent(String(chapterId))}/fetch`, method: 'POST', signal
},
options);
}
export const getFetchChapterMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchChapter>>, TError,{chapterId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof fetchChapter>>, TError,{chapterId: number}, TContext> => {
const mutationKey = ['fetchChapter'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof fetchChapter>>, {chapterId: number}> = (props) => {
const {chapterId} = props ?? {};
return fetchChapter(chapterId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FetchChapterMutationResult = NonNullable<Awaited<ReturnType<typeof fetchChapter>>>
export type FetchChapterMutationError = unknown
/**
* @summary Fetch chapter
*/
export const useFetchChapter = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchChapter>>, TError,{chapterId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof fetchChapter>>,
TError,
{chapterId: number},
TContext
> => {
const mutationOptions = getFetchChapterMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Download a chapter as a compressed file by its ID.
* @summary Download chapter archive
*/
@ -291,96 +218,4 @@ export const useDownloadChapterArchive = <TError = unknown,
return useMutation(mutationOptions, queryClient);
}
/**
* Retrieve a list of manga chapter images for a specific manga/provider combination.
* @summary Get the images for a specific manga/provider combination
*/
export const getMangaChapterImages = (
chapterId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOMangaChapterImagesDTO>(
{url: `/mangas/chapters/${encodeURIComponent(String(chapterId))}/images`, method: 'GET', signal
},
options);
}
export const getGetMangaChapterImagesQueryKey = (chapterId?: number,) => {
return [
`/mangas/chapters/${chapterId}/images`
] as const;
}
export const getGetMangaChapterImagesQueryOptions = <TData = Awaited<ReturnType<typeof getMangaChapterImages>>, TError = unknown>(chapterId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapterImages>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaChapterImagesQueryKey(chapterId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangaChapterImages>>> = ({ signal }) => getMangaChapterImages(chapterId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(chapterId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangaChapterImages>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaChapterImagesQueryResult = NonNullable<Awaited<ReturnType<typeof getMangaChapterImages>>>
export type GetMangaChapterImagesQueryError = unknown
export function useGetMangaChapterImages<TData = Awaited<ReturnType<typeof getMangaChapterImages>>, TError = unknown>(
chapterId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapterImages>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaChapterImages>>,
TError,
Awaited<ReturnType<typeof getMangaChapterImages>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaChapterImages<TData = Awaited<ReturnType<typeof getMangaChapterImages>>, TError = unknown>(
chapterId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapterImages>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaChapterImages>>,
TError,
Awaited<ReturnType<typeof getMangaChapterImages>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaChapterImages<TData = Awaited<ReturnType<typeof getMangaChapterImages>>, TError = unknown>(
chapterId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapterImages>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get the images for a specific manga/provider combination
*/
export function useGetMangaChapterImages<TData = Awaited<ReturnType<typeof getMangaChapterImages>>, TError = unknown>(
chapterId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapterImages>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaChapterImagesQueryOptions(chapterId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -1,258 +0,0 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
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 {
DefaultResponseDTOListImportReviewDTO,
DefaultResponseDTOVoid,
ResolveImportReviewParams
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Get list of pending import reviews.
* @summary Get list of pending import reviews
*/
export const getImportReviews = (
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOListImportReviewDTO>(
{url: `/manga/import/review`, method: 'GET', signal
},
options);
}
export const getGetImportReviewsQueryKey = () => {
return [
`/manga/import/review`
] as const;
}
export const getGetImportReviewsQueryOptions = <TData = Awaited<ReturnType<typeof getImportReviews>>, TError = unknown>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getImportReviews>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetImportReviewsQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getImportReviews>>> = ({ signal }) => getImportReviews(requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getImportReviews>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetImportReviewsQueryResult = NonNullable<Awaited<ReturnType<typeof getImportReviews>>>
export type GetImportReviewsQueryError = unknown
export function useGetImportReviews<TData = Awaited<ReturnType<typeof getImportReviews>>, TError = unknown>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getImportReviews>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getImportReviews>>,
TError,
Awaited<ReturnType<typeof getImportReviews>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetImportReviews<TData = Awaited<ReturnType<typeof getImportReviews>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getImportReviews>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getImportReviews>>,
TError,
Awaited<ReturnType<typeof getImportReviews>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetImportReviews<TData = Awaited<ReturnType<typeof getImportReviews>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getImportReviews>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get list of pending import reviews
*/
export function useGetImportReviews<TData = Awaited<ReturnType<typeof getImportReviews>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getImportReviews>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetImportReviewsQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Resolve import review by ID.
* @summary Resolve import review
*/
export const resolveImportReview = (
params: ResolveImportReviewParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/manga/import/review`, method: 'POST',
params, signal
},
options);
}
export const getResolveImportReviewMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resolveImportReview>>, TError,{params: ResolveImportReviewParams}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof resolveImportReview>>, TError,{params: ResolveImportReviewParams}, TContext> => {
const mutationKey = ['resolveImportReview'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof resolveImportReview>>, {params: ResolveImportReviewParams}> = (props) => {
const {params} = props ?? {};
return resolveImportReview(params,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type ResolveImportReviewMutationResult = NonNullable<Awaited<ReturnType<typeof resolveImportReview>>>
export type ResolveImportReviewMutationError = unknown
/**
* @summary Resolve import review
*/
export const useResolveImportReview = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resolveImportReview>>, TError,{params: ResolveImportReviewParams}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof resolveImportReview>>,
TError,
{params: ResolveImportReviewParams},
TContext
> => {
const mutationOptions = getResolveImportReviewMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Delete pending import review by ID.
* @summary Delete pending import review
*/
export const deleteImportReview = (
id: number,
options?: SecondParameter<typeof customInstance>,) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/manga/import/review/${encodeURIComponent(String(id))}`, method: 'DELETE'
},
options);
}
export const getDeleteImportReviewMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteImportReview>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof deleteImportReview>>, TError,{id: number}, TContext> => {
const mutationKey = ['deleteImportReview'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteImportReview>>, {id: number}> = (props) => {
const {id} = props ?? {};
return deleteImportReview(id,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type DeleteImportReviewMutationResult = NonNullable<Awaited<ReturnType<typeof deleteImportReview>>>
export type DeleteImportReviewMutationError = unknown
/**
* @summary Delete pending import review
*/
export const useDeleteImportReview = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteImportReview>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deleteImportReview>>,
TError,
{id: number},
TContext
> => {
const mutationOptions = getDeleteImportReviewMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}

View File

@ -0,0 +1,258 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
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 {
DefaultResponseDTOListMangaIngestReviewDTO,
DefaultResponseDTOVoid,
ResolveMangaIngestReviewParams
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Get list of pending manga ingest reviews.
* @summary Get list of pending manga ingest reviews
*/
export const getMangaIngestReviews = (
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOListMangaIngestReviewDTO>(
{url: `/catalog/ingest-reviews`, method: 'GET', signal
},
options);
}
export const getGetMangaIngestReviewsQueryKey = () => {
return [
`/catalog/ingest-reviews`
] as const;
}
export const getGetMangaIngestReviewsQueryOptions = <TData = Awaited<ReturnType<typeof getMangaIngestReviews>>, TError = unknown>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaIngestReviews>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaIngestReviewsQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangaIngestReviews>>> = ({ signal }) => getMangaIngestReviews(requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangaIngestReviews>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaIngestReviewsQueryResult = NonNullable<Awaited<ReturnType<typeof getMangaIngestReviews>>>
export type GetMangaIngestReviewsQueryError = unknown
export function useGetMangaIngestReviews<TData = Awaited<ReturnType<typeof getMangaIngestReviews>>, TError = unknown>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaIngestReviews>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaIngestReviews>>,
TError,
Awaited<ReturnType<typeof getMangaIngestReviews>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaIngestReviews<TData = Awaited<ReturnType<typeof getMangaIngestReviews>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaIngestReviews>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaIngestReviews>>,
TError,
Awaited<ReturnType<typeof getMangaIngestReviews>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaIngestReviews<TData = Awaited<ReturnType<typeof getMangaIngestReviews>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaIngestReviews>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get list of pending manga ingest reviews
*/
export function useGetMangaIngestReviews<TData = Awaited<ReturnType<typeof getMangaIngestReviews>>, TError = unknown>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaIngestReviews>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaIngestReviewsQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Resolve manga ingest review by ID.
* @summary Resolve manga ingest review
*/
export const resolveMangaIngestReview = (
params: ResolveMangaIngestReviewParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/catalog/ingest-reviews`, method: 'POST',
params, signal
},
options);
}
export const getResolveMangaIngestReviewMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resolveMangaIngestReview>>, TError,{params: ResolveMangaIngestReviewParams}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof resolveMangaIngestReview>>, TError,{params: ResolveMangaIngestReviewParams}, TContext> => {
const mutationKey = ['resolveMangaIngestReview'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof resolveMangaIngestReview>>, {params: ResolveMangaIngestReviewParams}> = (props) => {
const {params} = props ?? {};
return resolveMangaIngestReview(params,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type ResolveMangaIngestReviewMutationResult = NonNullable<Awaited<ReturnType<typeof resolveMangaIngestReview>>>
export type ResolveMangaIngestReviewMutationError = unknown
/**
* @summary Resolve manga ingest review
*/
export const useResolveMangaIngestReview = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resolveMangaIngestReview>>, TError,{params: ResolveMangaIngestReviewParams}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof resolveMangaIngestReview>>,
TError,
{params: ResolveMangaIngestReviewParams},
TContext
> => {
const mutationOptions = getResolveMangaIngestReviewMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Delete pending manga ingest review by ID.
* @summary Delete pending manga ingest review
*/
export const deleteMangaIngestReview = (
id: number,
options?: SecondParameter<typeof customInstance>,) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/catalog/ingest-reviews/${encodeURIComponent(String(id))}`, method: 'DELETE'
},
options);
}
export const getDeleteMangaIngestReviewMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteMangaIngestReview>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof deleteMangaIngestReview>>, TError,{id: number}, TContext> => {
const mutationKey = ['deleteMangaIngestReview'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteMangaIngestReview>>, {id: number}> = (props) => {
const {id} = props ?? {};
return deleteMangaIngestReview(id,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type DeleteMangaIngestReviewMutationResult = NonNullable<Awaited<ReturnType<typeof deleteMangaIngestReview>>>
export type DeleteMangaIngestReviewMutationError = unknown
/**
* @summary Delete pending manga ingest review
*/
export const useDeleteMangaIngestReview = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteMangaIngestReview>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deleteMangaIngestReview>>,
TError,
{id: number},
TContext
> => {
const mutationOptions = getDeleteMangaIngestReviewMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}

View File

@ -5,30 +5,17 @@
* OpenAPI spec version: v0
*/
import {
useMutation,
useQuery
useMutation
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
UseMutationResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOListMangaChapterDTO,
DefaultResponseDTOMangaDTO,
DefaultResponseDTOPageMangaListDTO,
DefaultResponseDTOVoid,
GetMangasParams
DefaultResponseDTOVoid
} from '../api.schemas';
import { customInstance } from '../../api';
@ -38,69 +25,6 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Fetch a list of manga chapters for a specific manga/provider combination.
* @summary Fetch the available chapters for a specific manga/provider combination
*/
export const fetchMangaChapters = (
mangaProviderId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/mangas/${encodeURIComponent(String(mangaProviderId))}/fetch-chapters`, method: 'POST', signal
},
options);
}
export const getFetchMangaChaptersMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchMangaChapters>>, TError,{mangaProviderId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof fetchMangaChapters>>, TError,{mangaProviderId: number}, TContext> => {
const mutationKey = ['fetchMangaChapters'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof fetchMangaChapters>>, {mangaProviderId: number}> = (props) => {
const {mangaProviderId} = props ?? {};
return fetchMangaChapters(mangaProviderId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FetchMangaChaptersMutationResult = NonNullable<Awaited<ReturnType<typeof fetchMangaChapters>>>
export type FetchMangaChaptersMutationError = unknown
/**
* @summary Fetch the available chapters for a specific manga/provider combination
*/
export const useFetchMangaChapters = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchMangaChapters>>, TError,{mangaProviderId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof fetchMangaChapters>>,
TError,
{mangaProviderId: number},
TContext
> => {
const mutationOptions = getFetchMangaChaptersMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Unfollow the manga specified by its ID.
* @summary Unfollow the manga specified by its ID
@ -227,283 +151,4 @@ export const useFollowManga = <TError = unknown,
return useMutation(mutationOptions, queryClient);
}
/**
* Retrieve a list of mangas with their details.
* @summary Get a list of mangas
*/
export const getMangas = (
params?: GetMangasParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOPageMangaListDTO>(
{url: `/mangas`, method: 'GET',
params, signal
},
options);
}
export const getGetMangasQueryKey = (params?: GetMangasParams,) => {
return [
`/mangas`, ...(params ? [params]: [])
] as const;
}
export const getGetMangasQueryOptions = <TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangasQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangas>>> = ({ signal }) => getMangas(params, requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangasQueryResult = NonNullable<Awaited<ReturnType<typeof getMangas>>>
export type GetMangasQueryError = unknown
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params: undefined | GetMangasParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangas>>,
TError,
Awaited<ReturnType<typeof getMangas>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangas>>,
TError,
Awaited<ReturnType<typeof getMangas>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get a list of mangas
*/
export function useGetMangas<TData = Awaited<ReturnType<typeof getMangas>>, TError = unknown>(
params?: GetMangasParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangas>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangasQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Retrieve a list of manga chapters for a specific manga/provider combination.
* @summary Get the available chapters for a specific manga/provider combination
*/
export const getMangaChapters = (
mangaProviderId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOListMangaChapterDTO>(
{url: `/mangas/${encodeURIComponent(String(mangaProviderId))}/chapters`, method: 'GET', signal
},
options);
}
export const getGetMangaChaptersQueryKey = (mangaProviderId?: number,) => {
return [
`/mangas/${mangaProviderId}/chapters`
] as const;
}
export const getGetMangaChaptersQueryOptions = <TData = Awaited<ReturnType<typeof getMangaChapters>>, TError = unknown>(mangaProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapters>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaChaptersQueryKey(mangaProviderId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMangaChapters>>> = ({ signal }) => getMangaChapters(mangaProviderId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(mangaProviderId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMangaChapters>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaChaptersQueryResult = NonNullable<Awaited<ReturnType<typeof getMangaChapters>>>
export type GetMangaChaptersQueryError = unknown
export function useGetMangaChapters<TData = Awaited<ReturnType<typeof getMangaChapters>>, TError = unknown>(
mangaProviderId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapters>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaChapters>>,
TError,
Awaited<ReturnType<typeof getMangaChapters>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaChapters<TData = Awaited<ReturnType<typeof getMangaChapters>>, TError = unknown>(
mangaProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapters>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMangaChapters>>,
TError,
Awaited<ReturnType<typeof getMangaChapters>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMangaChapters<TData = Awaited<ReturnType<typeof getMangaChapters>>, TError = unknown>(
mangaProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapters>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get the available chapters for a specific manga/provider combination
*/
export function useGetMangaChapters<TData = Awaited<ReturnType<typeof getMangaChapters>>, TError = unknown>(
mangaProviderId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMangaChapters>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaChaptersQueryOptions(mangaProviderId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* Get the details of a manga by its ID
* @summary Get the details of a manga
*/
export const getManga = (
mangaId: number,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOMangaDTO>(
{url: `/mangas/${encodeURIComponent(String(mangaId))}`, method: 'GET', signal
},
options);
}
export const getGetMangaQueryKey = (mangaId?: number,) => {
return [
`/mangas/${mangaId}`
] as const;
}
export const getGetMangaQueryOptions = <TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMangaQueryKey(mangaId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getManga>>> = ({ signal }) => getManga(mangaId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(mangaId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMangaQueryResult = NonNullable<Awaited<ReturnType<typeof getManga>>>
export type GetMangaQueryError = unknown
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getManga>>,
TError,
Awaited<ReturnType<typeof getManga>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getManga>>,
TError,
Awaited<ReturnType<typeof getManga>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get the details of a manga
*/
export function useGetManga<TData = Awaited<ReturnType<typeof getManga>>, TError = unknown>(
mangaId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getManga>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMangaQueryOptions(mangaId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -1,127 +0,0 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
import {
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOProviderListDTO,
GetProvidersParams
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Retrieve a list of content providers
* @summary Get a list of providers
*/
export const getProviders = (
params?: GetProvidersParams,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOProviderListDTO>(
{url: `/providers`, method: 'GET',
params, signal
},
options);
}
export const getGetProvidersQueryKey = (params?: GetProvidersParams,) => {
return [
`/providers`, ...(params ? [params]: [])
] as const;
}
export const getGetProvidersQueryOptions = <TData = Awaited<ReturnType<typeof getProviders>>, TError = unknown>(params?: GetProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProviders>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetProvidersQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProviders>>> = ({ signal }) => getProviders(params, requestOptions, signal);
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProviders>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetProvidersQueryResult = NonNullable<Awaited<ReturnType<typeof getProviders>>>
export type GetProvidersQueryError = unknown
export function useGetProviders<TData = Awaited<ReturnType<typeof getProviders>>, TError = unknown>(
params: undefined | GetProvidersParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProviders>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getProviders>>,
TError,
Awaited<ReturnType<typeof getProviders>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetProviders<TData = Awaited<ReturnType<typeof getProviders>>, TError = unknown>(
params?: GetProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProviders>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getProviders>>,
TError,
Awaited<ReturnType<typeof getProviders>>
> , 'initialData'
>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetProviders<TData = Awaited<ReturnType<typeof getProviders>>, TError = unknown>(
params?: GetProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProviders>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get a list of providers
*/
export function useGetProviders<TData = Awaited<ReturnType<typeof getProviders>>, TError = unknown>(
params?: GetProvidersParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProviders>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetProvidersQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}

View File

@ -0,0 +1,94 @@
/**
* Generated by orval v7.17.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
import {
useMutation
} from '@tanstack/react-query';
import type {
MutationFunction,
QueryClient,
UseMutationOptions,
UseMutationResult
} from '@tanstack/react-query';
import type {
DefaultResponseDTOVoid,
RegistrationRequestDTO
} from '../api.schemas';
import { customInstance } from '../../api';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Register a new user.
* @summary Register an user
*/
export const registerUser = (
registrationRequestDTO: RegistrationRequestDTO,
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
) => {
return customInstance<DefaultResponseDTOVoid>(
{url: `/user/register`, method: 'POST',
headers: {'Content-Type': 'application/json', },
data: registrationRequestDTO, signal
},
options);
}
export const getRegisterUserMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof registerUser>>, TError,{data: RegistrationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof registerUser>>, TError,{data: RegistrationRequestDTO}, TContext> => {
const mutationKey = ['registerUser'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof registerUser>>, {data: RegistrationRequestDTO}> = (props) => {
const {data} = props ?? {};
return registerUser(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type RegisterUserMutationResult = NonNullable<Awaited<ReturnType<typeof registerUser>>>
export type RegisterUserMutationBody = RegistrationRequestDTO
export type RegisterUserMutationError = unknown
/**
* @summary Register an user
*/
export const useRegisterUser = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof registerUser>>, TError,{data: RegistrationRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof registerUser>>,
TError,
{data: RegistrationRequestDTO},
TContext
> => {
const mutationOptions = getRegisterUserMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}

View File

@ -6,10 +6,8 @@ import {
useState,
} from "react";
import { toast } from "sonner";
import {
useAuthenticateUser,
useRegisterUser,
} from "@/api/generated/auth/auth.ts";
import {useRegisterUser} from "@/api/generated/user/user.ts";
import {useLogin} from "@/api/generated/authentication/authentication.ts";
export interface UserPreferences {
theme: "light" | "dark";
@ -55,7 +53,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
});
const { mutate: mutateAuthenticateUser, isPending: isPendingLoginUser } =
useAuthenticateUser({
useLogin({
mutation: {
onSuccess: (response) => {
if (!response.data) {

View File

@ -1,11 +1,11 @@
import { Star, X } from "lucide-react";
import { useGetGenres } from "@/api/generated/genre/genre.ts";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator.tsx";
import { Skeleton } from "@/components/ui/skeleton.tsx";
import { Switch } from "@/components/ui/switch.tsx";
import { useAuth } from "@/contexts/AuthContext.tsx";
import {useGetGenres} from "@/api/generated/catalog/catalog.ts";
interface FilterSidebarProps {
selectedGenres: number[];

View File

@ -4,7 +4,6 @@ import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";
import { useImportFromProvider } from "@/api/generated/manga-import/manga-import.ts";
import { useGetProviders } from "@/api/generated/provider/provider.ts";
import { Button } from "@/components/ui/button";
import {
Dialog,
@ -31,6 +30,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select.tsx";
import {useGetContentProviders} from "@/api/generated/ingestion/ingestion.ts";
interface ProviderImportDialogProps {
dialogOpen: boolean;
@ -59,7 +59,7 @@ export const ProviderImportDialog = ({
});
const { data: providerData, isFetching: isFetchingProviders } =
useGetProviders({ manualImport: true });
useGetContentProviders({ manualImport: true });
const { mutate: importFromProvider, isPending: isPendingImportFromProvider } =
useImportFromProvider({
@ -122,7 +122,7 @@ export const ProviderImportDialog = ({
{providerData?.data?.providers?.map((provider) => (
<SelectItem
key={provider.id}
value={provider.id.toString()}
value={provider.id ? provider.id.toString() : ""}
>
{provider.name}
</SelectItem>

View File

@ -2,17 +2,17 @@ import { useQueryClient } from "@tanstack/react-query";
import { ExternalLink, Trash2 } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import type { ImportReviewDTO } from "@/api/generated/api.schemas.ts";
import {
useDeleteImportReview,
useResolveImportReview,
} from "@/api/generated/manga-import-review/manga-import-review.ts";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import type {MangaIngestReviewDTO} from "@/api/generated/api.schemas.ts";
import {
useDeleteMangaIngestReview,
useResolveMangaIngestReview
} from "@/api/generated/manga-ingest-review/manga-ingest-review.ts";
interface ImportReviewCardProps {
importReview: ImportReviewDTO;
importReview: MangaIngestReviewDTO;
queryKey: any;
}
@ -24,7 +24,7 @@ export function ImportReviewCard({
const [malId, setMalId] = useState("");
const { mutate: mutateDeleteImportReview } = useDeleteImportReview({
const { mutate: mutateDeleteImportReview } = useDeleteMangaIngestReview({
mutation: {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey });
@ -37,7 +37,7 @@ export function ImportReviewCard({
const {
mutate: mutateResolveImportReview,
isPending: isPendingResolveImportReview,
} = useResolveImportReview({
} = useResolveMangaIngestReview({
mutation: {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey });
@ -53,7 +53,7 @@ export function ImportReviewCard({
}
mutateResolveImportReview({
params: { importReviewId: importReview.id, malId },
params: { id: importReview.id, malId },
});
};
@ -73,7 +73,7 @@ export function ImportReviewCard({
</h3>
<p className="text-sm text-muted-foreground">
Provider:{" "}
<span className="capitalize">{importReview.providerName}</span> {" "}
<span className="capitalize">{importReview.contentProviderName}</span> {" "}
{importDate}
</p>
</div>

View File

@ -2,13 +2,13 @@ import { useQueryClient } from "@tanstack/react-query";
import { Check, Database, Download, Eye, Loader2 } from "lucide-react";
import { useCallback, useState } from "react";
import { useNavigate } from "react-router";
import { useGetMangaChapters } from "@/api/generated/manga/manga.ts";
import {
useDownloadChapterArchive,
useFetchChapter,
} from "@/api/generated/manga-chapter/manga-chapter.ts";
import { Button } from "@/components/ui/button";
import ReactCountryFlag from "react-country-flag";
import {useGetMangaProviderContent} from "@/api/generated/content/content.ts";
import {useFetchContentProviderContent} from "@/api/generated/ingestion/ingestion.ts";
interface MangaChapterProps {
mangaId: number;
@ -21,7 +21,7 @@ export const MangaChapter = ({
}: MangaChapterProps) => {
const navigate = useNavigate();
const { isPending, data, queryKey } = useGetMangaChapters(mangaProviderId);
const { isPending, data, queryKey } = useGetMangaProviderContent(mangaProviderId);
const queryClient = useQueryClient();
@ -40,7 +40,7 @@ export const MangaChapter = ({
},
});
const { mutate, isPending: isPendingFetchChapter } = useFetchChapter({
const { mutate, isPending: isPendingFetchChapter } = useFetchContentProviderContent({
mutation: {
onSuccess: () => queryClient.invalidateQueries({ queryKey }),
onSettled: () => setFetchingId(null),
@ -52,7 +52,7 @@ export const MangaChapter = ({
const fetchChapter = useCallback(
(mangaChapterId: number) => {
setFetchingId(mangaChapterId);
mutate({ chapterId: mangaChapterId });
mutate({ mangaContentId: mangaChapterId });
},
[mutate],
);

View File

@ -2,12 +2,12 @@ import { ArrowLeft, ChevronLeft, ChevronRight, Home } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { useNavigate, useParams } from "react-router";
import {
useGetMangaChapterImages,
useMarkAsRead,
} from "@/api/generated/manga-chapter/manga-chapter.ts";
import { ThemeToggle } from "@/components/ThemeToggle.tsx";
import { Button } from "@/components/ui/button";
import { useReadingTracker } from "@/features/chapter/hooks/useReadingTracker.ts";
import {useGetMangaContentImages} from "@/api/generated/content/content.ts";
const Chapter = () => {
const { setCurrentChapterPage, getCurrentChapterPage } = useReadingTracker();
@ -23,7 +23,7 @@ const Chapter = () => {
const [infiniteScroll, setInfiniteScroll] = useState(true);
const { data, isLoading } = useGetMangaChapterImages(chapterNumber);
const { data, isLoading } = useGetMangaContentImages(chapterNumber);
const { mutate } = useMarkAsRead();
// For infinite scroll mode
@ -34,7 +34,7 @@ const Chapter = () => {
useEffect(() => {
if (!data || isLoading) return;
if (currentPage === data.data?.chapterImageKeys.length) {
if (currentPage === data.data?.contentImageKeys.length) {
mutate({ chapterId: chapterNumber });
}
}, [data, mutate, currentPage]);
@ -63,7 +63,7 @@ const Chapter = () => {
const obs = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting) {
setVisibleCount((count) =>
Math.min(count + 2, data?.data?.chapterImageKeys.length ?? 0),
Math.min(count + 2, data?.data?.contentImageKeys.length ?? 0),
);
}
});
@ -126,7 +126,7 @@ const Chapter = () => {
);
}
const images = data.data.chapterImageKeys;
const images = data.data.contentImageKeys;
/** Standard navigation (non-infinite mode) */
const goToNextPage = () => {

View File

@ -1,7 +1,6 @@
import { BookOpen, Search } from "lucide-react";
import { useEffect, useRef } from "react";
import { useDebounce } from "use-debounce";
import { useGetMangas } from "@/api/generated/manga/manga.ts";
import { AuthHeader } from "@/components/AuthHeader.tsx";
import { Pagination } from "@/components/Pagination.tsx";
import { ThemeToggle } from "@/components/ThemeToggle.tsx";
@ -14,6 +13,7 @@ import {
} from "@/features/home/components/SortDropdown.tsx";
import { useUIState } from "@/contexts/UIStateContext.tsx";
import { useDynamicPageSize } from "@/hooks/useDynamicPageSize.ts";
import {useGetMangas} from "@/api/generated/catalog/catalog.ts";
const ROWS_PER_PAGE = 4;

View File

@ -3,16 +3,16 @@
import { AlertCircle } from "lucide-react";
import { useEffect } from "react";
import { useNavigate } from "react-router";
import { useGetImportReviews } from "@/api/generated/manga-import-review/manga-import-review.ts";
import { Card } from "@/components/ui/card";
import { useAuth } from "@/contexts/AuthContext.tsx";
import { ImportReviewCard } from "@/features/import-review/ImportReviewCard.tsx";
import {useGetMangaIngestReviews} from "@/api/generated/manga-ingest-review/manga-ingest-review.ts";
export default function ImportReviewPage() {
const navigate = useNavigate();
const { user, isAuthenticated } = useAuth();
const { data: importReviewData, queryKey } = useGetImportReviews();
const { data: importReviewData, queryKey } = useGetMangaIngestReviews();
useEffect(() => {
if (!user) {

View File

@ -18,9 +18,7 @@ import {
useSetUnfavorite,
} from "@/api/generated/favorite-mangas/favorite-mangas.ts";
import {
useFetchMangaChapters,
useFollowManga,
useGetManga,
useUnfollowManga,
} from "@/api/generated/manga/manga.ts";
import { useFetchAllChapters } from "@/api/generated/manga-chapter/manga-chapter.ts";
@ -38,6 +36,8 @@ import { useUIState } from "@/contexts/UIStateContext.tsx";
import { useScrollPersistence } from "@/hooks/useScrollPersistence.ts";
import { MangaChapter } from "@/features/manga/MangaChapter.tsx";
import { formatToTwoDigitsDateRange } from "@/utils/dateFormatter.ts";
import {useGetManga} from "@/api/generated/catalog/catalog.ts";
import {useFetchContentProviderContentList} from "@/api/generated/ingestion/ingestion.ts";
const Manga = () => {
const { isAuthenticated } = useAuth();
@ -49,7 +49,7 @@ const Manga = () => {
const { data: mangaData, queryKey } = useGetManga(mangaId);
const { mutate, isPending: fetchPending } = useFetchMangaChapters({
const { mutate, isPending: fetchPending } = useFetchContentProviderContentList({
mutation: {
onSuccess: () => queryClient.invalidateQueries({ queryKey }),
},
@ -349,8 +349,8 @@ const Manga = () => {
{mangaData.data?.providers.map((provider) => (
<Card key={provider.id} className="border-border bg-card">
<Collapsible
open={expandedProviderIds.includes(provider.id)}
onOpenChange={() => toggleProvider(provider.id)}
open={expandedProviderIds.includes(provider.id ?? -1)}
onOpenChange={() => toggleProvider(provider.id ?? -1)}
>
<CollapsibleTrigger className="w-full">
<CardContent className="flex items-center justify-between p-4">
@ -368,28 +368,28 @@ const Manga = () => {
</div>
</div>
{provider.supportsChapterFetch &&
provider.providerStatus === "ACTIVE" && (
provider.active && (
<div className={"flex gap-4 pr-4"}>
{/*<Button*/}
{/* size="sm"*/}
{/* variant="outline"*/}
{/* disabled={isPending}*/}
{/* onClick={() =>*/}
{/* fetchAllMutate({*/}
{/* mangaProviderId: provider.id?? -1,*/}
{/* })*/}
{/* }*/}
{/* className="gap-2"*/}
{/*>*/}
{/* <Database className="h-4 w-4" />*/}
{/* Fetch all from Provider*/}
{/*</Button>*/}
<Button
size="sm"
variant="outline"
disabled={isPending}
onClick={() =>
fetchAllMutate({
mangaProviderId: provider.id,
})
}
className="gap-2"
>
<Database className="h-4 w-4" />
Fetch all from Provider
</Button>
<Button
size="sm"
variant="outline"
disabled={isPending}
onClick={() =>
mutate({ mangaProviderId: provider.id })
mutate({ mangaContentProviderId: provider.id ?? -1 })
}
className="gap-2"
>
@ -400,7 +400,7 @@ const Manga = () => {
)}
</div>
<ChevronDown
className={`h-5 w-5 text-muted-foreground transition-transform ${expandedProviderIds.includes(provider.id) ? "rotate-180" : ""
className={`h-5 w-5 text-muted-foreground transition-transform ${expandedProviderIds.includes(provider.id ?? -1) ? "rotate-180" : ""
}`}
/>
</CardContent>
@ -408,7 +408,7 @@ const Manga = () => {
<CollapsibleContent>
<MangaChapter
mangaId={mangaId}
mangaProviderId={provider.id}
mangaProviderId={provider.id ?? -1}
/>
</CollapsibleContent>
</Collapsible>