|
|
|
@@ -41,6 +41,8 @@ import {
|
|
|
|
CategoryOrderBy,
|
|
|
|
CategoryOrderBy,
|
|
|
|
CheckForServerUpdatesQuery,
|
|
|
|
CheckForServerUpdatesQuery,
|
|
|
|
CheckForServerUpdatesQueryVariables,
|
|
|
|
CheckForServerUpdatesQueryVariables,
|
|
|
|
|
|
|
|
ClearDownloaderMutation,
|
|
|
|
|
|
|
|
ClearDownloaderMutationVariables,
|
|
|
|
CreateCategoryInput,
|
|
|
|
CreateCategoryInput,
|
|
|
|
CreateCategoryMutation,
|
|
|
|
CreateCategoryMutation,
|
|
|
|
CreateCategoryMutationVariables,
|
|
|
|
CreateCategoryMutationVariables,
|
|
|
|
@@ -50,6 +52,14 @@ import {
|
|
|
|
DeleteDownloadedChapterMutationVariables,
|
|
|
|
DeleteDownloadedChapterMutationVariables,
|
|
|
|
DeleteDownloadedChaptersMutation,
|
|
|
|
DeleteDownloadedChaptersMutation,
|
|
|
|
DeleteDownloadedChaptersMutationVariables,
|
|
|
|
DeleteDownloadedChaptersMutationVariables,
|
|
|
|
|
|
|
|
DequeueChapterDownloadMutation,
|
|
|
|
|
|
|
|
DequeueChapterDownloadMutationVariables,
|
|
|
|
|
|
|
|
DequeueChapterDownloadsMutation,
|
|
|
|
|
|
|
|
DequeueChapterDownloadsMutationVariables,
|
|
|
|
|
|
|
|
EnqueueChapterDownloadMutation,
|
|
|
|
|
|
|
|
EnqueueChapterDownloadMutationVariables,
|
|
|
|
|
|
|
|
EnqueueChapterDownloadsMutation,
|
|
|
|
|
|
|
|
EnqueueChapterDownloadsMutationVariables,
|
|
|
|
GetAboutQuery,
|
|
|
|
GetAboutQuery,
|
|
|
|
GetAboutQueryVariables,
|
|
|
|
GetAboutQueryVariables,
|
|
|
|
GetExtensionsFetchMutation,
|
|
|
|
GetExtensionsFetchMutation,
|
|
|
|
@@ -66,6 +76,8 @@ import {
|
|
|
|
GetSourcesQueryVariables,
|
|
|
|
GetSourcesQueryVariables,
|
|
|
|
InstallExternalExtensionMutation,
|
|
|
|
InstallExternalExtensionMutation,
|
|
|
|
InstallExternalExtensionMutationVariables,
|
|
|
|
InstallExternalExtensionMutationVariables,
|
|
|
|
|
|
|
|
ReorderChapterDownloadMutation,
|
|
|
|
|
|
|
|
ReorderChapterDownloadMutationVariables,
|
|
|
|
SetCategoryMetadataMutation,
|
|
|
|
SetCategoryMetadataMutation,
|
|
|
|
SetCategoryMetadataMutationVariables,
|
|
|
|
SetCategoryMetadataMutationVariables,
|
|
|
|
SetChapterMetadataMutation,
|
|
|
|
SetChapterMetadataMutation,
|
|
|
|
@@ -73,6 +85,10 @@ import {
|
|
|
|
SetGlobalMetadataMutation,
|
|
|
|
SetGlobalMetadataMutation,
|
|
|
|
SetGlobalMetadataMutationVariables,
|
|
|
|
SetGlobalMetadataMutationVariables,
|
|
|
|
SetMangaMetadataMutation,
|
|
|
|
SetMangaMetadataMutation,
|
|
|
|
|
|
|
|
StartDownloaderMutation,
|
|
|
|
|
|
|
|
StartDownloaderMutationVariables,
|
|
|
|
|
|
|
|
StopDownloaderMutation,
|
|
|
|
|
|
|
|
StopDownloaderMutationVariables,
|
|
|
|
UpdateCategoryMutation,
|
|
|
|
UpdateCategoryMutation,
|
|
|
|
UpdateCategoryMutationVariables,
|
|
|
|
UpdateCategoryMutationVariables,
|
|
|
|
UpdateCategoryOrderMutation,
|
|
|
|
UpdateCategoryOrderMutation,
|
|
|
|
@@ -106,7 +122,18 @@ import { SET_MANGA_METADATA, UPDATE_MANGA, UPDATE_MANGA_CATEGORIES } from '@/lib
|
|
|
|
import { GET_MANGA, GET_MANGAS } from '@/lib/graphql/queries/MangaQuery.ts';
|
|
|
|
import { GET_MANGA, GET_MANGAS } from '@/lib/graphql/queries/MangaQuery.ts';
|
|
|
|
import { GET_CATEGORIES, GET_CATEGORY, GET_CATEGORY_MANGAS } from '@/lib/graphql/queries/CategoryQuery.ts';
|
|
|
|
import { GET_CATEGORIES, GET_CATEGORY, GET_CATEGORY_MANGAS } from '@/lib/graphql/queries/CategoryQuery.ts';
|
|
|
|
import { GET_SOURCE_MANGAS_FETCH } from '@/lib/graphql/mutations/SourceMutation.ts';
|
|
|
|
import { GET_SOURCE_MANGAS_FETCH } from '@/lib/graphql/mutations/SourceMutation.ts';
|
|
|
|
import { DELETE_DOWNLOADED_CHAPTER, DELETE_DOWNLOADED_CHAPTERS } from '@/lib/graphql/mutations/DownloaderMutation.ts';
|
|
|
|
import {
|
|
|
|
|
|
|
|
CLEAR_DOWNLOADER,
|
|
|
|
|
|
|
|
DELETE_DOWNLOADED_CHAPTER,
|
|
|
|
|
|
|
|
DELETE_DOWNLOADED_CHAPTERS,
|
|
|
|
|
|
|
|
DEQUEUE_CHAPTER_DOWNLOAD,
|
|
|
|
|
|
|
|
DEQUEUE_CHAPTER_DOWNLOADS,
|
|
|
|
|
|
|
|
ENQUEUE_CHAPTER_DOWNLOAD,
|
|
|
|
|
|
|
|
ENQUEUE_CHAPTER_DOWNLOADS,
|
|
|
|
|
|
|
|
REORDER_CHAPTER_DOWNLOAD,
|
|
|
|
|
|
|
|
START_DOWNLOADER,
|
|
|
|
|
|
|
|
STOP_DOWNLOADER,
|
|
|
|
|
|
|
|
} from '@/lib/graphql/mutations/DownloaderMutation.ts';
|
|
|
|
import { GET_CHAPTER, GET_CHAPTERS } from '@/lib/graphql/queries/ChapterQuery.ts';
|
|
|
|
import { GET_CHAPTER, GET_CHAPTERS } from '@/lib/graphql/queries/ChapterQuery.ts';
|
|
|
|
import { SET_CHAPTER_METADATA, UPDATE_CHAPTER, UPDATE_CHAPTERS } from '@/lib/graphql/mutations/ChapterMutation.ts';
|
|
|
|
import { SET_CHAPTER_METADATA, UPDATE_CHAPTER, UPDATE_CHAPTERS } from '@/lib/graphql/mutations/ChapterMutation.ts';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
@@ -116,6 +143,7 @@ import {
|
|
|
|
UPDATE_CATEGORY,
|
|
|
|
UPDATE_CATEGORY,
|
|
|
|
UPDATE_CATEGORY_ORDER,
|
|
|
|
UPDATE_CATEGORY_ORDER,
|
|
|
|
} from '@/lib/graphql/mutations/CategoryMutation.ts';
|
|
|
|
} from '@/lib/graphql/mutations/CategoryMutation.ts';
|
|
|
|
|
|
|
|
import { GET_DOWNLOAD_STATUS } from '@/lib/graphql/queries/DownloaderQuery.ts';
|
|
|
|
|
|
|
|
|
|
|
|
enum SWRHttpMethod {
|
|
|
|
enum SWRHttpMethod {
|
|
|
|
SWR_GET,
|
|
|
|
SWR_GET,
|
|
|
|
@@ -923,43 +951,79 @@ export class RequestManager {
|
|
|
|
return this.getValidUrlFor('backup/export/file');
|
|
|
|
return this.getValidUrlFor('backup/export/file');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public startDownloads(): AbortableAxiosResponse {
|
|
|
|
public startDownloads(): AbortableApolloMutationResponse<StartDownloaderMutation> {
|
|
|
|
return this.doRequest(HttpMethod.GET, 'downloads/start');
|
|
|
|
return this.doRequestNew<StartDownloaderMutation, StartDownloaderMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
START_DOWNLOADER,
|
|
|
|
|
|
|
|
{},
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public stopDownloads(): AbortableAxiosResponse {
|
|
|
|
public stopDownloads(): AbortableApolloMutationResponse<StopDownloaderMutation> {
|
|
|
|
return this.doRequest(HttpMethod.GET, 'downloads/stop');
|
|
|
|
return this.doRequestNew<StopDownloaderMutation, StopDownloaderMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
STOP_DOWNLOADER,
|
|
|
|
|
|
|
|
{},
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public clearDownloads(): AbortableAxiosResponse {
|
|
|
|
public clearDownloads(): AbortableApolloMutationResponse<ClearDownloaderMutation> {
|
|
|
|
return this.doRequest(HttpMethod.GET, 'downloads/clear');
|
|
|
|
return this.doRequestNew<ClearDownloaderMutation, ClearDownloaderMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
CLEAR_DOWNLOADER,
|
|
|
|
|
|
|
|
{},
|
|
|
|
|
|
|
|
{ refetchQueries: [GET_DOWNLOAD_STATUS] },
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public addChapterToDownloadQueue(mangaId: number | string, chapterIndex: number | string): AbortableAxiosResponse {
|
|
|
|
public addChapterToDownloadQueue(id: number): AbortableApolloMutationResponse<EnqueueChapterDownloadMutation> {
|
|
|
|
return this.doRequest(HttpMethod.GET, `download/${mangaId}/chapter/${chapterIndex}`);
|
|
|
|
return this.doRequestNew<EnqueueChapterDownloadMutation, EnqueueChapterDownloadMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
ENQUEUE_CHAPTER_DOWNLOAD,
|
|
|
|
|
|
|
|
{ input: { id } },
|
|
|
|
|
|
|
|
{ refetchQueries: [GET_DOWNLOAD_STATUS] },
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public removeChapterFromDownloadQueue(
|
|
|
|
public removeChapterFromDownloadQueue(id: number): AbortableApolloMutationResponse<DequeueChapterDownloadMutation> {
|
|
|
|
mangaId: number | string,
|
|
|
|
return this.doRequestNew<DequeueChapterDownloadMutation, DequeueChapterDownloadMutationVariables>(
|
|
|
|
chapterIndex: number | string,
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
): AbortableAxiosResponse {
|
|
|
|
DEQUEUE_CHAPTER_DOWNLOAD,
|
|
|
|
return this.doRequest(HttpMethod.DELETE, `download/${mangaId}/chapter/${chapterIndex}`);
|
|
|
|
{ input: { id } },
|
|
|
|
|
|
|
|
{ refetchQueries: [GET_DOWNLOAD_STATUS] },
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public reorderChapterInDownloadQueue(
|
|
|
|
public reorderChapterInDownloadQueue(
|
|
|
|
mangaId: number | string,
|
|
|
|
chapterId: number,
|
|
|
|
chapterIndex: number | string,
|
|
|
|
|
|
|
|
position: number,
|
|
|
|
position: number,
|
|
|
|
): AbortableAxiosResponse {
|
|
|
|
): AbortableApolloMutationResponse<ReorderChapterDownloadMutation> {
|
|
|
|
return this.doRequest(HttpMethod.PATCH, `download/${mangaId}/chapter/${chapterIndex}/reorder/${position}`);
|
|
|
|
return this.doRequestNew<ReorderChapterDownloadMutation, ReorderChapterDownloadMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
REORDER_CHAPTER_DOWNLOAD,
|
|
|
|
|
|
|
|
{ input: { chapterId, to: position } },
|
|
|
|
|
|
|
|
{ refetchQueries: [GET_DOWNLOAD_STATUS] },
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public addChaptersToDownloadQueue(chapterIds: number[]): AbortableAxiosResponse {
|
|
|
|
public addChaptersToDownloadQueue(ids: number[]): AbortableApolloMutationResponse<EnqueueChapterDownloadsMutation> {
|
|
|
|
return this.doRequest(HttpMethod.POST, 'download/batch', { data: { chapterIds } });
|
|
|
|
return this.doRequestNew<EnqueueChapterDownloadsMutation, EnqueueChapterDownloadsMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
ENQUEUE_CHAPTER_DOWNLOADS,
|
|
|
|
|
|
|
|
{ input: { ids } },
|
|
|
|
|
|
|
|
{ refetchQueries: [GET_DOWNLOAD_STATUS] },
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public removeChaptersFromDownloadQueue(chapterIds: number[]): AbortableAxiosResponse {
|
|
|
|
public removeChaptersFromDownloadQueue(
|
|
|
|
return this.doRequest(HttpMethod.DELETE, 'download/batch', { data: { chapterIds } });
|
|
|
|
ids: number[],
|
|
|
|
|
|
|
|
): AbortableApolloMutationResponse<DequeueChapterDownloadsMutation> {
|
|
|
|
|
|
|
|
return this.doRequestNew<DequeueChapterDownloadsMutation, DequeueChapterDownloadsMutationVariables>(
|
|
|
|
|
|
|
|
GQLMethod.MUTATION,
|
|
|
|
|
|
|
|
DEQUEUE_CHAPTER_DOWNLOADS,
|
|
|
|
|
|
|
|
{ input: { ids } },
|
|
|
|
|
|
|
|
{ refetchQueries: [GET_DOWNLOAD_STATUS] },
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public useGetRecentlyUpdatedChapters(
|
|
|
|
public useGetRecentlyUpdatedChapters(
|
|
|
|
|