All checks were successful
ci/woodpecker/push/pipeline Pipeline was successful
1738 lines
60 KiB
TypeScript
1738 lines
60 KiB
TypeScript
/**
|
|
* Generated by orval v7.14.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 { customInstance } from './api';
|
|
export interface UpdateMangaDataCommand {
|
|
mangaId?: number;
|
|
}
|
|
|
|
export interface DefaultResponseDTOVoid {
|
|
timestamp?: string;
|
|
data?: unknown;
|
|
message?: string;
|
|
}
|
|
|
|
export interface ImportMangaDexRequestDTO {
|
|
id: string;
|
|
}
|
|
|
|
export interface DefaultResponseDTOImportMangaDexResponseDTO {
|
|
timestamp?: string;
|
|
data?: ImportMangaDexResponseDTO;
|
|
message?: string;
|
|
}
|
|
|
|
export interface ImportMangaDexResponseDTO {
|
|
id: number;
|
|
}
|
|
|
|
export interface RegistrationRequestDTO {
|
|
name?: string;
|
|
email?: string;
|
|
password?: string;
|
|
}
|
|
|
|
export interface AuthenticationRequestDTO {
|
|
email: string;
|
|
password: string;
|
|
}
|
|
|
|
export type AuthenticationResponseDTORole = typeof AuthenticationResponseDTORole[keyof typeof AuthenticationResponseDTORole];
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
export const AuthenticationResponseDTORole = {
|
|
USER: 'USER',
|
|
} as const;
|
|
|
|
export interface AuthenticationResponseDTO {
|
|
id: number;
|
|
token: string;
|
|
email: string;
|
|
name: string;
|
|
role: AuthenticationResponseDTORole;
|
|
}
|
|
|
|
export interface DefaultResponseDTOAuthenticationResponseDTO {
|
|
timestamp?: string;
|
|
data?: AuthenticationResponseDTO;
|
|
message?: string;
|
|
}
|
|
|
|
export interface DefaultResponseDTOPageMangaListDTO {
|
|
timestamp?: string;
|
|
data?: PageMangaListDTO;
|
|
message?: string;
|
|
}
|
|
|
|
export interface MangaListDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
title: string;
|
|
coverImageKey?: string;
|
|
status?: string;
|
|
publishedFrom?: string;
|
|
publishedTo?: string;
|
|
providerCount?: number;
|
|
genres: string[];
|
|
authors: string[];
|
|
score: number;
|
|
favorite: boolean;
|
|
}
|
|
|
|
export interface PageMangaListDTO {
|
|
totalPages?: number;
|
|
totalElements?: number;
|
|
size?: number;
|
|
content?: MangaListDTO[];
|
|
number?: number;
|
|
pageable?: PageableObject;
|
|
first?: boolean;
|
|
last?: boolean;
|
|
sort?: SortObject;
|
|
numberOfElements?: number;
|
|
empty?: boolean;
|
|
}
|
|
|
|
export interface PageableObject {
|
|
offset?: number;
|
|
paged?: boolean;
|
|
pageNumber?: number;
|
|
pageSize?: number;
|
|
sort?: SortObject;
|
|
unpaged?: boolean;
|
|
}
|
|
|
|
export interface SortObject {
|
|
empty?: boolean;
|
|
sorted?: boolean;
|
|
unsorted?: boolean;
|
|
}
|
|
|
|
export interface DefaultResponseDTOListMangaChapterDTO {
|
|
timestamp?: string;
|
|
data?: MangaChapterDTO[];
|
|
message?: string;
|
|
}
|
|
|
|
export interface MangaChapterDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
title: string;
|
|
downloaded: boolean;
|
|
isRead: boolean;
|
|
}
|
|
|
|
export interface DefaultResponseDTOMangaDTO {
|
|
timestamp?: string;
|
|
data?: MangaDTO;
|
|
message?: string;
|
|
}
|
|
|
|
export interface MangaDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
title: string;
|
|
coverImageKey?: string;
|
|
status?: string;
|
|
publishedFrom?: string;
|
|
publishedTo?: string;
|
|
synopsis?: string;
|
|
providerCount?: number;
|
|
alternativeTitles: string[];
|
|
genres: string[];
|
|
authors: string[];
|
|
score: number;
|
|
providers: MangaProviderDTO[];
|
|
chapterCount: number;
|
|
}
|
|
|
|
export interface MangaProviderDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
providerName: string;
|
|
chaptersAvailable: number;
|
|
chaptersDownloaded: number;
|
|
supportsChapterFetch: boolean;
|
|
}
|
|
|
|
export interface DefaultResponseDTOMangaChapterImagesDTO {
|
|
timestamp?: string;
|
|
data?: MangaChapterImagesDTO;
|
|
message?: string;
|
|
}
|
|
|
|
export interface MangaChapterImagesDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
mangaTitle: string;
|
|
chapterImageKeys: string[];
|
|
}
|
|
|
|
export interface DefaultResponseDTOListImportReviewDTO {
|
|
timestamp?: string;
|
|
data?: ImportReviewDTO[];
|
|
message?: string;
|
|
}
|
|
|
|
export interface ImportReviewDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
title: string;
|
|
/** @minLength 1 */
|
|
providerName: string;
|
|
externalUrl?: string;
|
|
/** @minLength 1 */
|
|
reason: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface DefaultResponseDTOListGenreDTO {
|
|
timestamp?: string;
|
|
data?: GenreDTO[];
|
|
message?: string;
|
|
}
|
|
|
|
export interface GenreDTO {
|
|
id: number;
|
|
/** @minLength 1 */
|
|
name: string;
|
|
}
|
|
|
|
export type DownloadChapterArchiveParams = {
|
|
archiveFileType: DownloadChapterArchiveArchiveFileType;
|
|
};
|
|
|
|
export type DownloadChapterArchiveArchiveFileType = typeof DownloadChapterArchiveArchiveFileType[keyof typeof DownloadChapterArchiveArchiveFileType];
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
export const DownloadChapterArchiveArchiveFileType = {
|
|
CBZ: 'CBZ',
|
|
CBR: 'CBR',
|
|
} as const;
|
|
|
|
export type ImportMultipleFilesBody = {
|
|
/** @minLength 1 */
|
|
malId: string;
|
|
/** List of files to upload */
|
|
files: Blob[];
|
|
};
|
|
|
|
export type ResolveImportReviewParams = {
|
|
importReviewId: number;
|
|
malId: string;
|
|
};
|
|
|
|
export type GetMangasParams = {
|
|
searchQuery?: string;
|
|
genreIds?: number[];
|
|
statuses?: string[];
|
|
userFavorites?: boolean;
|
|
score?: number;
|
|
/**
|
|
* Zero-based page index (0..N)
|
|
* @minimum 0
|
|
*/
|
|
page?: number;
|
|
/**
|
|
* The size of the page to be returned
|
|
* @minimum 1
|
|
*/
|
|
size?: number;
|
|
/**
|
|
* Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
|
|
*/
|
|
sort?: string[];
|
|
};
|
|
|
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
|
|
|
|
|
|
export const sendRecord = (
|
|
updateMangaDataCommand: UpdateMangaDataCommand,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<string>(
|
|
{url: `/records`, method: 'POST',
|
|
headers: {'Content-Type': 'application/json', },
|
|
data: updateMangaDataCommand, signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getSendRecordMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendRecord>>, TError,{data: UpdateMangaDataCommand}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof sendRecord>>, TError,{data: UpdateMangaDataCommand}, TContext> => {
|
|
|
|
const mutationKey = ['sendRecord'];
|
|
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 sendRecord>>, {data: UpdateMangaDataCommand}> = (props) => {
|
|
const {data} = props ?? {};
|
|
|
|
return sendRecord(data,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type SendRecordMutationResult = NonNullable<Awaited<ReturnType<typeof sendRecord>>>
|
|
export type SendRecordMutationBody = UpdateMangaDataCommand
|
|
export type SendRecordMutationError = unknown
|
|
|
|
export const useSendRecord = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof sendRecord>>, TError,{data: UpdateMangaDataCommand}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof sendRecord>>,
|
|
TError,
|
|
{data: UpdateMangaDataCommand},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getSendRecordMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
|
|
/**
|
|
* Fetch all not yet downloaded chapters from the provider
|
|
* @summary Fetch all chapters
|
|
*/
|
|
export const fetchAllChapters = (
|
|
mangaProviderId: number,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<DefaultResponseDTOVoid>(
|
|
{url: `/mangas/${encodeURIComponent(String(mangaProviderId))}/fetch-all-chapters`, method: 'POST', signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getFetchAllChaptersMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchAllChapters>>, TError,{mangaProviderId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof fetchAllChapters>>, TError,{mangaProviderId: number}, TContext> => {
|
|
|
|
const mutationKey = ['fetchAllChapters'];
|
|
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 fetchAllChapters>>, {mangaProviderId: number}> = (props) => {
|
|
const {mangaProviderId} = props ?? {};
|
|
|
|
return fetchAllChapters(mangaProviderId,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type FetchAllChaptersMutationResult = NonNullable<Awaited<ReturnType<typeof fetchAllChapters>>>
|
|
|
|
export type FetchAllChaptersMutationError = unknown
|
|
|
|
/**
|
|
* @summary Fetch all chapters
|
|
*/
|
|
export const useFetchAllChapters = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof fetchAllChapters>>, TError,{mangaProviderId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof fetchAllChapters>>,
|
|
TError,
|
|
{mangaProviderId: number},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getFetchAllChaptersMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* Remove a manga from favorites for the logged user.
|
|
* @summary Unfavorite a manga
|
|
*/
|
|
export const setUnfavorite = (
|
|
id: number,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<DefaultResponseDTOVoid>(
|
|
{url: `/mangas/${encodeURIComponent(String(id))}/unfavorite`, method: 'POST', signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getSetUnfavoriteMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setUnfavorite>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof setUnfavorite>>, TError,{id: number}, TContext> => {
|
|
|
|
const mutationKey = ['setUnfavorite'];
|
|
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 setUnfavorite>>, {id: number}> = (props) => {
|
|
const {id} = props ?? {};
|
|
|
|
return setUnfavorite(id,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type SetUnfavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof setUnfavorite>>>
|
|
|
|
export type SetUnfavoriteMutationError = unknown
|
|
|
|
/**
|
|
* @summary Unfavorite a manga
|
|
*/
|
|
export const useSetUnfavorite = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setUnfavorite>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof setUnfavorite>>,
|
|
TError,
|
|
{id: number},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getSetUnfavoriteMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* Set a manga as favorite for the logged user.
|
|
* @summary Favorite a manga
|
|
*/
|
|
export const setFavorite = (
|
|
id: number,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<DefaultResponseDTOVoid>(
|
|
{url: `/mangas/${encodeURIComponent(String(id))}/favorite`, method: 'POST', signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getSetFavoriteMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setFavorite>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof setFavorite>>, TError,{id: number}, TContext> => {
|
|
|
|
const mutationKey = ['setFavorite'];
|
|
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 setFavorite>>, {id: number}> = (props) => {
|
|
const {id} = props ?? {};
|
|
|
|
return setFavorite(id,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type SetFavoriteMutationResult = NonNullable<Awaited<ReturnType<typeof setFavorite>>>
|
|
|
|
export type SetFavoriteMutationError = unknown
|
|
|
|
/**
|
|
* @summary Favorite a manga
|
|
*/
|
|
export const useSetFavorite = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setFavorite>>, TError,{id: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof setFavorite>>,
|
|
TError,
|
|
{id: number},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getSetFavoriteMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* Mark a chapter as read by its ID.
|
|
* @summary Mark a chapter as read
|
|
*/
|
|
export const markAsRead = (
|
|
chapterId: number,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<DefaultResponseDTOVoid>(
|
|
{url: `/mangas/chapters/${encodeURIComponent(String(chapterId))}/mark-as-read`, method: 'POST', signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getMarkAsReadMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof markAsRead>>, TError,{chapterId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof markAsRead>>, TError,{chapterId: number}, TContext> => {
|
|
|
|
const mutationKey = ['markAsRead'];
|
|
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 markAsRead>>, {chapterId: number}> = (props) => {
|
|
const {chapterId} = props ?? {};
|
|
|
|
return markAsRead(chapterId,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type MarkAsReadMutationResult = NonNullable<Awaited<ReturnType<typeof markAsRead>>>
|
|
|
|
export type MarkAsReadMutationError = unknown
|
|
|
|
/**
|
|
* @summary Mark a chapter as read
|
|
*/
|
|
export const useMarkAsRead = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof markAsRead>>, TError,{chapterId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof markAsRead>>,
|
|
TError,
|
|
{chapterId: number},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getMarkAsReadMutationOptions(options);
|
|
|
|
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
|
|
*/
|
|
export const downloadChapterArchive = (
|
|
chapterId: number,
|
|
params: DownloadChapterArchiveParams,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<Blob>(
|
|
{url: `/mangas/chapters/${encodeURIComponent(String(chapterId))}/download`, method: 'POST',
|
|
params,
|
|
responseType: 'blob', signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getDownloadChapterArchiveMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof downloadChapterArchive>>, TError,{chapterId: number;params: DownloadChapterArchiveParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof downloadChapterArchive>>, TError,{chapterId: number;params: DownloadChapterArchiveParams}, TContext> => {
|
|
|
|
const mutationKey = ['downloadChapterArchive'];
|
|
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 downloadChapterArchive>>, {chapterId: number;params: DownloadChapterArchiveParams}> = (props) => {
|
|
const {chapterId,params} = props ?? {};
|
|
|
|
return downloadChapterArchive(chapterId,params,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type DownloadChapterArchiveMutationResult = NonNullable<Awaited<ReturnType<typeof downloadChapterArchive>>>
|
|
|
|
export type DownloadChapterArchiveMutationError = unknown
|
|
|
|
/**
|
|
* @summary Download chapter archive
|
|
*/
|
|
export const useDownloadChapterArchive = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof downloadChapterArchive>>, TError,{chapterId: number;params: DownloadChapterArchiveParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof downloadChapterArchive>>,
|
|
TError,
|
|
{chapterId: number;params: DownloadChapterArchiveParams},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getDownloadChapterArchiveMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* Accepts multiple files via multipart/form-data and processes them.
|
|
* @summary Upload multiple files
|
|
*/
|
|
export const importMultipleFiles = (
|
|
importMultipleFilesBody: ImportMultipleFilesBody,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
const formData = new FormData();
|
|
formData.append(`malId`, importMultipleFilesBody.malId)
|
|
importMultipleFilesBody.files.forEach(value => formData.append(`files`, value));
|
|
|
|
return customInstance<DefaultResponseDTOVoid>(
|
|
{url: `/manga/import/upload`, method: 'POST',
|
|
headers: {'Content-Type': 'multipart/form-data', },
|
|
data: formData, signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getImportMultipleFilesMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof importMultipleFiles>>, TError,{data: ImportMultipleFilesBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof importMultipleFiles>>, TError,{data: ImportMultipleFilesBody}, TContext> => {
|
|
|
|
const mutationKey = ['importMultipleFiles'];
|
|
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 importMultipleFiles>>, {data: ImportMultipleFilesBody}> = (props) => {
|
|
const {data} = props ?? {};
|
|
|
|
return importMultipleFiles(data,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type ImportMultipleFilesMutationResult = NonNullable<Awaited<ReturnType<typeof importMultipleFiles>>>
|
|
export type ImportMultipleFilesMutationBody = ImportMultipleFilesBody
|
|
export type ImportMultipleFilesMutationError = unknown
|
|
|
|
/**
|
|
* @summary Upload multiple files
|
|
*/
|
|
export const useImportMultipleFiles = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof importMultipleFiles>>, TError,{data: ImportMultipleFilesBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof importMultipleFiles>>,
|
|
TError,
|
|
{data: ImportMultipleFilesBody},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getImportMultipleFilesMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
|
|
/**
|
|
* Imports manga data from MangaDex into the local database.
|
|
* @summary Import manga from MangaDex
|
|
*/
|
|
export const importFromMangaDex = (
|
|
importMangaDexRequestDTO: ImportMangaDexRequestDTO,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<DefaultResponseDTOImportMangaDexResponseDTO>(
|
|
{url: `/manga/import/manga-dex`, method: 'POST',
|
|
headers: {'Content-Type': 'application/json', },
|
|
data: importMangaDexRequestDTO, signal
|
|
},
|
|
options);
|
|
}
|
|
|
|
|
|
|
|
export const getImportFromMangaDexMutationOptions = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof importFromMangaDex>>, TError,{data: ImportMangaDexRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
): UseMutationOptions<Awaited<ReturnType<typeof importFromMangaDex>>, TError,{data: ImportMangaDexRequestDTO}, TContext> => {
|
|
|
|
const mutationKey = ['importFromMangaDex'];
|
|
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 importFromMangaDex>>, {data: ImportMangaDexRequestDTO}> = (props) => {
|
|
const {data} = props ?? {};
|
|
|
|
return importFromMangaDex(data,requestOptions)
|
|
}
|
|
|
|
|
|
|
|
|
|
return { mutationFn, ...mutationOptions }}
|
|
|
|
export type ImportFromMangaDexMutationResult = NonNullable<Awaited<ReturnType<typeof importFromMangaDex>>>
|
|
export type ImportFromMangaDexMutationBody = ImportMangaDexRequestDTO
|
|
export type ImportFromMangaDexMutationError = unknown
|
|
|
|
/**
|
|
* @summary Import manga from MangaDex
|
|
*/
|
|
export const useImportFromMangaDex = <TError = unknown,
|
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof importFromMangaDex>>, TError,{data: ImportMangaDexRequestDTO}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
, queryClient?: QueryClient): UseMutationResult<
|
|
Awaited<ReturnType<typeof importFromMangaDex>>,
|
|
TError,
|
|
{data: ImportMangaDexRequestDTO},
|
|
TContext
|
|
> => {
|
|
|
|
const mutationOptions = getImportFromMangaDexMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
}
|
|
|
|
/**
|
|
* Register a new user.
|
|
* @summary Register user
|
|
*/
|
|
export const registerUser = (
|
|
registrationRequestDTO: RegistrationRequestDTO,
|
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
) => {
|
|
|
|
|
|
return customInstance<DefaultResponseDTOVoid>(
|
|
{url: `/auth/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 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);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 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);
|
|
}
|