/** * 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 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 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 MangaChapterDTO { id: number; /** @minLength 1 */ title: string; downloaded: boolean; isRead: boolean; } 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[]; } export interface MangaProviderDTO { id: number; /** @minLength 1 */ providerName: string; chaptersAvailable: number; chaptersDownloaded: number; } export interface MangaChapterImagesDTO { id: number; /** @minLength 1 */ mangaTitle: string; chapterImageKeys: 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 GetMangasParams = { searchQuery?: string; genreIds?: number[]; statuses?: string[]; userFavorites?: boolean; /** * 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 unknown> = Parameters[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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(mangaProviderId))}/fetch-chapters`, method: "POST", signal, }, options, ); }; export const getFetchMangaChaptersMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { mangaProviderId: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { mangaProviderId: number } > = (props) => { const { mangaProviderId } = props ?? {}; return fetchMangaChapters(mangaProviderId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type FetchMangaChaptersMutationResult = NonNullable< Awaited> >; export type FetchMangaChaptersMutationError = unknown; /** * @summary Fetch the available chapters for a specific manga/provider combination */ export const useFetchMangaChapters = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { mangaProviderId: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { mangaProviderId: number }, TContext > => { const mutationOptions = getFetchMangaChaptersMutationOptions(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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(id))}/unfavorite`, method: "POST", signal, }, options, ); }; export const getSetUnfavoriteMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { id: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { id: number } > = (props) => { const { id } = props ?? {}; return setUnfavorite(id, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type SetUnfavoriteMutationResult = NonNullable< Awaited> >; export type SetUnfavoriteMutationError = unknown; /** * @summary Unfavorite a manga */ export const useSetUnfavorite = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { id: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, 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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(id))}/favorite`, method: "POST", signal, }, options, ); }; export const getSetFavoriteMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { id: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { id: number } > = (props) => { const { id } = props ?? {}; return setFavorite(id, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type SetFavoriteMutationResult = NonNullable< Awaited> >; export type SetFavoriteMutationError = unknown; /** * @summary Favorite a manga */ export const useSetFavorite = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { id: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, 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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(chapterId))}/mark-as-read`, method: "POST", signal, }, options, ); }; export const getMarkAsReadMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { chapterId: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { chapterId: number } > = (props) => { const { chapterId } = props ?? {}; return markAsRead(chapterId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type MarkAsReadMutationResult = NonNullable< Awaited> >; export type MarkAsReadMutationError = unknown; /** * @summary Mark a chapter as read */ export const useMarkAsRead = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { chapterId: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { chapterId: number }, TContext > => { const mutationOptions = getMarkAsReadMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary Update manga info */ export const updateMangaInfo = ( mangaId: number, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/manga/${encodeURIComponent(String(mangaId))}/info`, method: "POST", signal, }, options, ); }; export const getUpdateMangaInfoMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { mangaId: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { mangaId: number }, TContext > => { const mutationKey = ["updateMangaInfo"]; 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>, { mangaId: number } > = (props) => { const { mangaId } = props ?? {}; return updateMangaInfo(mangaId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type UpdateMangaInfoMutationResult = NonNullable< Awaited> >; export type UpdateMangaInfoMutationError = unknown; /** * @summary Update manga info */ export const useUpdateMangaInfo = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { mangaId: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { mangaId: number }, TContext > => { const mutationOptions = getUpdateMangaInfoMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary Download all chapters for a manga provider */ export const downloadAllChapters = ( mangaProviderId: number, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/chapter/${encodeURIComponent(String(mangaProviderId))}/download-all`, method: "POST", signal, }, options, ); }; export const getDownloadAllChaptersMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { mangaProviderId: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, { mangaProviderId: number }, TContext > => { const mutationKey = ["downloadAllChapters"]; 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>, { mangaProviderId: number } > = (props) => { const { mangaProviderId } = props ?? {}; return downloadAllChapters(mangaProviderId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type DownloadAllChaptersMutationResult = NonNullable< Awaited> >; export type DownloadAllChaptersMutationError = unknown; /** * @summary Download all chapters for a manga provider */ export const useDownloadAllChapters = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { mangaProviderId: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { mangaProviderId: number }, TContext > => { const mutationOptions = getDownloadAllChaptersMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary Fetch chapter */ export const fetchChapter = ( chapterId: number, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/chapter/${encodeURIComponent(String(chapterId))}/fetch`, method: "POST", signal, }, options, ); }; export const getFetchChapterMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { chapterId: number }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { chapterId: number } > = (props) => { const { chapterId } = props ?? {}; return fetchChapter(chapterId, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type FetchChapterMutationResult = NonNullable< Awaited> >; export type FetchChapterMutationError = unknown; /** * @summary Fetch chapter */ export const useFetchChapter = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { chapterId: number }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { chapterId: number }, TContext > => { const mutationOptions = getFetchChapterMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * @summary Download chapter archive */ export const downloadChapterArchive = ( chapterId: number, params: DownloadChapterArchiveParams, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/chapter/${encodeURIComponent(String(chapterId))}/download-archive`, method: "POST", params, responseType: "blob", signal, }, options, ); }; export const getDownloadChapterArchiveMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { chapterId: number; params: DownloadChapterArchiveParams }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { chapterId: number; params: DownloadChapterArchiveParams } > = (props) => { const { chapterId, params } = props ?? {}; return downloadChapterArchive(chapterId, params, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type DownloadChapterArchiveMutationResult = NonNullable< Awaited> >; export type DownloadChapterArchiveMutationError = unknown; /** * @summary Download chapter archive */ export const useDownloadChapterArchive = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { chapterId: number; params: DownloadChapterArchiveParams }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, TError, { chapterId: number; params: DownloadChapterArchiveParams }, TContext > => { const mutationOptions = getDownloadChapterArchiveMutationOptions(options); return useMutation(mutationOptions, queryClient); }; /** * Register a new user. * @summary Register user */ export const registerUser = ( registrationRequestDTO: RegistrationRequestDTO, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/auth/register`, method: "POST", headers: { "Content-Type": "application/json" }, data: registrationRequestDTO, signal, }, options, ); }; export const getRegisterUserMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: RegistrationRequestDTO }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { data: RegistrationRequestDTO } > = (props) => { const { data } = props ?? {}; return registerUser(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type RegisterUserMutationResult = NonNullable< Awaited> >; export type RegisterUserMutationBody = RegistrationRequestDTO; export type RegisterUserMutationError = unknown; /** * @summary Register user */ export const useRegisterUser = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: RegistrationRequestDTO }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, 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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/auth/login`, method: "POST", headers: { "Content-Type": "application/json" }, data: authenticationRequestDTO, signal, }, options, ); }; export const getAuthenticateUserMutationOptions = < TError = unknown, TContext = unknown, >(options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: AuthenticationRequestDTO }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, 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>, { data: AuthenticationRequestDTO } > = (props) => { const { data } = props ?? {}; return authenticateUser(data, requestOptions); }; return { mutationFn, ...mutationOptions }; }; export type AuthenticateUserMutationResult = NonNullable< Awaited> >; export type AuthenticateUserMutationBody = AuthenticationRequestDTO; export type AuthenticateUserMutationError = unknown; /** * @summary Authenticate user */ export const useAuthenticateUser = ( options?: { mutation?: UseMutationOptions< Awaited>, TError, { data: AuthenticationRequestDTO }, TContext >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseMutationResult< Awaited>, 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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas`, method: "GET", params, signal }, options, ); }; export const getGetMangasQueryKey = (params?: GetMangasParams) => { return [ `http://192.168.1.142:8080/mangas`, ...(params ? [params] : []), ] as const; }; export const getGetMangasQueryOptions = < TData = Awaited>, TError = unknown, >( params?: GetMangasParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetMangasQueryKey(params); const queryFn: QueryFunction>> = ({ signal, }) => getMangas(params, requestOptions, signal); return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type GetMangasQueryResult = NonNullable< Awaited> >; export type GetMangasQueryError = unknown; export function useGetMangas< TData = Awaited>, TError = unknown, >( params: undefined | GetMangasParams, options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetMangas< TData = Awaited>, TError = unknown, >( params?: GetMangasParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetMangas< TData = Awaited>, TError = unknown, >( params?: GetMangasParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary Get a list of mangas */ export function useGetMangas< TData = Awaited>, TError = unknown, >( params?: GetMangasParams, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetMangasQueryOptions(params, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; 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, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(mangaProviderId))}/chapters`, method: "GET", signal, }, options, ); }; export const getGetMangaChaptersQueryKey = (mangaProviderId?: number) => { return [ `http://192.168.1.142:8080/mangas/${mangaProviderId}/chapters`, ] as const; }; export const getGetMangaChaptersQueryOptions = < TData = Awaited>, TError = unknown, >( mangaProviderId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetMangaChaptersQueryKey(mangaProviderId); const queryFn: QueryFunction< Awaited> > = ({ signal }) => getMangaChapters(mangaProviderId, requestOptions, signal); return { queryKey, queryFn, enabled: !!mangaProviderId, ...queryOptions, } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type GetMangaChaptersQueryResult = NonNullable< Awaited> >; export type GetMangaChaptersQueryError = unknown; export function useGetMangaChapters< TData = Awaited>, TError = unknown, >( mangaProviderId: number, options: { query: Partial< UseQueryOptions< Awaited>, TError, TData > > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetMangaChapters< TData = Awaited>, TError = unknown, >( mangaProviderId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetMangaChapters< TData = Awaited>, TError = unknown, >( mangaProviderId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary Get the available chapters for a specific manga/provider combination */ export function useGetMangaChapters< TData = Awaited>, TError = unknown, >( mangaProviderId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetMangaChaptersQueryOptions( mangaProviderId, options, ); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; } /** * @summary Get the details of a manga */ export const getManga = ( mangaId: number, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(mangaId))}`, method: "GET", signal, }, options, ); }; export const getGetMangaQueryKey = (mangaId?: number) => { return [`http://192.168.1.142:8080/mangas/${mangaId}`] as const; }; export const getGetMangaQueryOptions = < TData = Awaited>, TError = unknown, >( mangaId: number, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetMangaQueryKey(mangaId); const queryFn: QueryFunction>> = ({ signal, }) => getManga(mangaId, requestOptions, signal); return { queryKey, queryFn, enabled: !!mangaId, ...queryOptions, } as UseQueryOptions>, TError, TData> & { queryKey: DataTag; }; }; export type GetMangaQueryResult = NonNullable< Awaited> >; export type GetMangaQueryError = unknown; export function useGetManga< TData = Awaited>, TError = unknown, >( mangaId: number, options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetManga< TData = Awaited>, TError = unknown, >( mangaId: number, options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetManga< TData = Awaited>, TError = unknown, >( mangaId: number, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary Get the details of a manga */ export function useGetManga< TData = Awaited>, TError = unknown, >( mangaId: number, options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetMangaQueryOptions(mangaId, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; 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 getMangaChapterImages = ( chapterId: number, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/mangas/${encodeURIComponent(String(chapterId))}/images`, method: "GET", signal, }, options, ); }; export const getGetMangaChapterImagesQueryKey = (chapterId?: number) => { return [`http://192.168.1.142:8080/mangas/${chapterId}/images`] as const; }; export const getGetMangaChapterImagesQueryOptions = < TData = Awaited>, TError = unknown, >( chapterId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, ) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetMangaChapterImagesQueryKey(chapterId); const queryFn: QueryFunction< Awaited> > = ({ signal }) => getMangaChapterImages(chapterId, requestOptions, signal); return { queryKey, queryFn, enabled: !!chapterId, ...queryOptions, } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type GetMangaChapterImagesQueryResult = NonNullable< Awaited> >; export type GetMangaChapterImagesQueryError = unknown; export function useGetMangaChapterImages< TData = Awaited>, TError = unknown, >( chapterId: number, options: { query: Partial< UseQueryOptions< Awaited>, TError, TData > > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetMangaChapterImages< TData = Awaited>, TError = unknown, >( chapterId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetMangaChapterImages< TData = Awaited>, TError = unknown, >( chapterId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary Get the available chapters for a specific manga/provider combination */ export function useGetMangaChapterImages< TData = Awaited>, TError = unknown, >( chapterId: number, options?: { query?: Partial< UseQueryOptions< Awaited>, TError, TData > >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetMangaChapterImagesQueryOptions(chapterId, options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; } /** * Retrieve a list of genres. * @summary Get a list of genres */ export const getGenres = ( options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( { url: `http://192.168.1.142:8080/genres`, method: "GET", signal }, options, ); }; export const getGetGenresQueryKey = () => { return [`http://192.168.1.142:8080/genres`] as const; }; export const getGetGenresQueryOptions = < TData = Awaited>, TError = unknown, >(options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }) => { const { query: queryOptions, request: requestOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? getGetGenresQueryKey(); const queryFn: QueryFunction>> = ({ signal, }) => getGenres(requestOptions, signal); return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< Awaited>, TError, TData > & { queryKey: DataTag }; }; export type GetGenresQueryResult = NonNullable< Awaited> >; export type GetGenresQueryError = unknown; export function useGetGenres< TData = Awaited>, TError = unknown, >( options: { query: Partial< UseQueryOptions>, TError, TData> > & Pick< DefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): DefinedUseQueryResult & { queryKey: DataTag; }; export function useGetGenres< TData = Awaited>, TError = unknown, >( options?: { query?: Partial< UseQueryOptions>, TError, TData> > & Pick< UndefinedInitialDataOptions< Awaited>, TError, Awaited> >, "initialData" >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; export function useGetGenres< TData = Awaited>, TError = unknown, >( options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; }; /** * @summary Get a list of genres */ export function useGetGenres< TData = Awaited>, TError = unknown, >( options?: { query?: Partial< UseQueryOptions>, TError, TData> >; request?: SecondParameter; }, queryClient?: QueryClient, ): UseQueryResult & { queryKey: DataTag; } { const queryOptions = getGetGenresQueryOptions(options); const query = useQuery(queryOptions, queryClient) as UseQueryResult< TData, TError > & { queryKey: DataTag }; query.queryKey = queryOptions.queryKey; return query; }