Add optional options arg to all requests

This commit is contained in:
schroda
2023-10-09 20:41:58 +02:00
parent d3e15e9d3b
commit fbcc1fb91a

View File

@@ -102,6 +102,7 @@ import {
SetGlobalMetadataMutation, SetGlobalMetadataMutation,
SetGlobalMetadataMutationVariables, SetGlobalMetadataMutationVariables,
SetMangaMetadataMutation, SetMangaMetadataMutation,
SetMangaMetadataMutationVariables,
SortOrder, SortOrder,
SourcePreferenceChangeInput, SourcePreferenceChangeInput,
StartDownloaderMutation, StartDownloaderMutation,
@@ -781,12 +782,16 @@ export class RequestManager {
return this.doRequestNew(GQLMethod.USE_QUERY, GET_GLOBAL_METADATAS, {}, options); return this.doRequestNew(GQLMethod.USE_QUERY, GET_GLOBAL_METADATAS, {}, options);
} }
public setGlobalMetadata(key: string, value: any): AbortableApolloMutationResponse<SetGlobalMetadataMutation> { public setGlobalMetadata(
key: string,
value: any,
options?: MutationOptions<SetGlobalMetadataMutation, SetGlobalMetadataMutationVariables>,
): AbortableApolloMutationResponse<SetGlobalMetadataMutation> {
return this.doRequestNew<SetGlobalMetadataMutation, SetGlobalMetadataMutationVariables>( return this.doRequestNew<SetGlobalMetadataMutation, SetGlobalMetadataMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
SET_GLOBAL_METADATA, SET_GLOBAL_METADATA,
{ input: { meta: { key, value: `${value}` } } }, { input: { meta: { key, value: `${value}` } } },
{ refetchQueries: [GET_GLOBAL_METADATA, GET_GLOBAL_METADATAS] }, { refetchQueries: [GET_GLOBAL_METADATA, GET_GLOBAL_METADATAS], ...options },
); );
} }
@@ -816,24 +821,26 @@ export class RequestManager {
public installExternalExtension( public installExternalExtension(
extensionFile: File, extensionFile: File,
options?: MutationOptions<InstallExternalExtensionMutation, InstallExternalExtensionMutationVariables>,
): AbortableApolloMutationResponse<InstallExternalExtensionMutation> { ): AbortableApolloMutationResponse<InstallExternalExtensionMutation> {
return this.doRequestNew<InstallExternalExtensionMutation, InstallExternalExtensionMutationVariables>( return this.doRequestNew<InstallExternalExtensionMutation, InstallExternalExtensionMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
INSTALL_EXTERNAL_EXTENSION, INSTALL_EXTERNAL_EXTENSION,
{ file: extensionFile }, { file: extensionFile },
{ refetchQueries: [GET_EXTENSION, GET_EXTENSIONS] }, { refetchQueries: [GET_EXTENSION, GET_EXTENSIONS], ...options },
); );
} }
public updateExtension( public updateExtension(
id: string, id: string,
patch: UpdateExtensionPatchInput, patch: UpdateExtensionPatchInput,
options?: MutationOptions<UpdateExtensionMutation, UpdateExtensionMutationVariables>,
): AbortableApolloMutationResponse<UpdateExtensionMutation> { ): AbortableApolloMutationResponse<UpdateExtensionMutation> {
return this.doRequestNew<UpdateExtensionMutation, UpdateExtensionMutationVariables>( return this.doRequestNew<UpdateExtensionMutation, UpdateExtensionMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_EXTENSION, UPDATE_EXTENSION,
{ input: { id, patch } }, { input: { id, patch } },
{ refetchQueries: [GET_EXTENSION, GET_EXTENSIONS, GET_SOURCES] }, { refetchQueries: [GET_EXTENSION, GET_EXTENSIONS, GET_SOURCES], ...options },
); );
} }
@@ -1160,6 +1167,7 @@ export class RequestManager {
mangaId: number, mangaId: number,
key: string, key: string,
value: any, value: any,
options?: MutationOptions<SetMangaMetadataMutation, SetMangaMetadataMutationVariables>,
): AbortableApolloMutationResponse<SetMangaMetadataMutation> { ): AbortableApolloMutationResponse<SetMangaMetadataMutation> {
return this.doRequestNew( return this.doRequestNew(
GQLMethod.MUTATION, GQLMethod.MUTATION,
@@ -1167,7 +1175,7 @@ export class RequestManager {
{ {
input: { meta: { mangaId, key, value: `${value}` } }, input: { meta: { mangaId, key, value: `${value}` } },
}, },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_SOURCE_MANGAS_FETCH] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_SOURCE_MANGAS_FETCH], ...options },
); );
} }
@@ -1237,6 +1245,7 @@ export class RequestManager {
public getChapter( public getChapter(
mangaId: number | string, mangaId: number | string,
chapterIndex: number | string, chapterIndex: number | string,
options?: QueryOptions<GetChaptersQueryVariables, GetChaptersQuery>,
): AbortabaleApolloQueryResponse< ): AbortabaleApolloQueryResponse<
Omit<GetChaptersQuery, 'chapters'> & { chapter: GetChaptersQuery['chapters']['nodes'][number] } Omit<GetChaptersQuery, 'chapters'> & { chapter: GetChaptersQuery['chapters']['nodes'][number] }
> { > {
@@ -1250,6 +1259,7 @@ export class RequestManager {
{ {
condition: { mangaId: Number(mangaId), sourceOrder: Number(chapterIndex) }, condition: { mangaId: Number(mangaId), sourceOrder: Number(chapterIndex) },
}, },
options,
); );
return { return {
@@ -1283,33 +1293,40 @@ export class RequestManager {
); );
} }
public deleteDownloadedChapter(id: number): AbortableApolloMutationResponse<DeleteDownloadedChapterMutation> { public deleteDownloadedChapter(
id: number,
options?: MutationOptions<DeleteDownloadedChapterMutation, DeleteDownloadedChapterMutationVariables>,
): AbortableApolloMutationResponse<DeleteDownloadedChapterMutation> {
return this.doRequestNew<DeleteDownloadedChapterMutation, DeleteDownloadedChapterMutationVariables>( return this.doRequestNew<DeleteDownloadedChapterMutation, DeleteDownloadedChapterMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
DELETE_DOWNLOADED_CHAPTER, DELETE_DOWNLOADED_CHAPTER,
{ input: { id } }, { input: { id } },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTERS] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTERS], ...options },
); );
} }
public deleteDownloadedChapters(ids: number[]): AbortableApolloMutationResponse<DeleteDownloadedChaptersMutation> { public deleteDownloadedChapters(
ids: number[],
options?: MutationOptions<DeleteDownloadedChaptersMutation, DeleteDownloadedChaptersMutationVariables>,
): AbortableApolloMutationResponse<DeleteDownloadedChaptersMutation> {
return this.doRequestNew<DeleteDownloadedChaptersMutation, DeleteDownloadedChaptersMutationVariables>( return this.doRequestNew<DeleteDownloadedChaptersMutation, DeleteDownloadedChaptersMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
DELETE_DOWNLOADED_CHAPTERS, DELETE_DOWNLOADED_CHAPTERS,
{ input: { ids } }, { input: { ids } },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTERS] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTERS], ...options },
); );
} }
public updateChapter( public updateChapter(
id: number, id: number,
patch: UpdateChapterPatchInput, patch: UpdateChapterPatchInput,
options?: MutationOptions<UpdateChapterMutation, UpdateChapterMutationVariables>,
): AbortableApolloMutationResponse<UpdateChapterMutation> { ): AbortableApolloMutationResponse<UpdateChapterMutation> {
return this.doRequestNew<UpdateChapterMutation, UpdateChapterMutationVariables>( return this.doRequestNew<UpdateChapterMutation, UpdateChapterMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CHAPTER, UPDATE_CHAPTER,
{ input: { id, patch } }, { input: { id, patch } },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTER, GET_CHAPTERS] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTER, GET_CHAPTERS], ...options },
); );
} }
@@ -1317,12 +1334,13 @@ export class RequestManager {
chapterId: number, chapterId: number,
key: string, key: string,
value: any, value: any,
options?: MutationOptions<SetChapterMetadataMutation, SetChapterMetadataMutationVariables>,
): AbortableApolloMutationResponse<SetChapterMetadataMutation> { ): AbortableApolloMutationResponse<SetChapterMetadataMutation> {
return this.doRequestNew<SetChapterMetadataMutation, SetChapterMetadataMutationVariables>( return this.doRequestNew<SetChapterMetadataMutation, SetChapterMetadataMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
SET_CHAPTER_METADATA, SET_CHAPTER_METADATA,
{ input: { meta: { chapterId, key, value: `${value}` } } }, { input: { meta: { chapterId, key, value: `${value}` } } },
{ refetchQueries: [GET_CHAPTER, GET_CHAPTERS] }, { refetchQueries: [GET_CHAPTER, GET_CHAPTERS], ...options },
); );
} }
@@ -1336,36 +1354,51 @@ export class RequestManager {
public updateChapters( public updateChapters(
ids: number[], ids: number[],
patch: UpdateChapterPatchInput, patch: UpdateChapterPatchInput,
options?: MutationOptions<UpdateChaptersMutation, UpdateChaptersMutationVariables>,
): AbortableApolloMutationResponse<UpdateChaptersMutation> { ): AbortableApolloMutationResponse<UpdateChaptersMutation> {
return this.doRequestNew<UpdateChaptersMutation, UpdateChaptersMutationVariables>( return this.doRequestNew<UpdateChaptersMutation, UpdateChaptersMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CHAPTERS, UPDATE_CHAPTERS,
{ input: { ids, patch } }, { input: { ids, patch } },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTER, GET_CHAPTERS] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY_MANGAS, GET_CHAPTER, GET_CHAPTERS], ...options },
); );
} }
public useGetCategories(): AbortableApolloUseQueryResponse<GetCategoriesQuery, GetCategoriesQueryVariables> { public useGetCategories(
return this.doRequestNew<GetCategoriesQuery, GetCategoriesQueryVariables>(GQLMethod.USE_QUERY, GET_CATEGORIES, { options?: QueryHookOptions<GetCategoriesQuery, GetCategoriesQueryVariables>,
orderBy: CategoryOrderBy.Order, ): AbortableApolloUseQueryResponse<GetCategoriesQuery, GetCategoriesQueryVariables> {
}); return this.doRequestNew<GetCategoriesQuery, GetCategoriesQueryVariables>(
GQLMethod.USE_QUERY,
GET_CATEGORIES,
{
orderBy: CategoryOrderBy.Order,
},
options,
);
} }
public createCategory(input: CreateCategoryInput): AbortableApolloMutationResponse<CreateCategoryMutation> { public createCategory(
input: CreateCategoryInput,
options?: MutationOptions<CreateCategoryMutation, CreateCategoryMutationVariables>,
): AbortableApolloMutationResponse<CreateCategoryMutation> {
return this.doRequestNew<CreateCategoryMutation, CreateCategoryMutationVariables>( return this.doRequestNew<CreateCategoryMutation, CreateCategoryMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
CREATE_CATEGORY, CREATE_CATEGORY,
{ input }, { input },
{ refetchQueries: [GET_CATEGORIES] }, { refetchQueries: [GET_CATEGORIES], ...options },
); );
} }
public reorderCategory(id: number, position: number): AbortableApolloMutationResponse<UpdateCategoryOrderMutation> { public reorderCategory(
id: number,
position: number,
options?: MutationOptions<UpdateCategoryOrderMutation, UpdateCategoryOrderMutationVariables>,
): AbortableApolloMutationResponse<UpdateCategoryOrderMutation> {
return this.doRequestNew<UpdateCategoryOrderMutation, UpdateCategoryOrderMutationVariables>( return this.doRequestNew<UpdateCategoryOrderMutation, UpdateCategoryOrderMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CATEGORY_ORDER, UPDATE_CATEGORY_ORDER,
{ input: { id, position } }, { input: { id, position } },
{ refetchQueries: [GET_CATEGORIES] }, { refetchQueries: [GET_CATEGORIES], ...options },
); );
} }
@@ -1376,24 +1409,28 @@ export class RequestManager {
return this.doRequestNew(GQLMethod.USE_QUERY, GET_CATEGORY_MANGAS, { id }, options); return this.doRequestNew(GQLMethod.USE_QUERY, GET_CATEGORY_MANGAS, { id }, options);
} }
public deleteCategory(categoryId: number): AbortableApolloMutationResponse<DeleteCategoryMutation> { public deleteCategory(
categoryId: number,
options?: MutationOptions<DeleteCategoryMutation, DeleteCategoryMutationVariables>,
): AbortableApolloMutationResponse<DeleteCategoryMutation> {
return this.doRequestNew<DeleteCategoryMutation, DeleteCategoryMutationVariables>( return this.doRequestNew<DeleteCategoryMutation, DeleteCategoryMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
DELETE_CATEGORY, DELETE_CATEGORY,
{ input: { categoryId } }, { input: { categoryId } },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORIES] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORIES], ...options },
); );
} }
public updateCategory( public updateCategory(
id: number, id: number,
patch: UpdateCategoryPatchInput, patch: UpdateCategoryPatchInput,
options?: MutationOptions<UpdateCategoryMutation, UpdateCategoryMutationVariables>,
): AbortableApolloMutationResponse<UpdateCategoryMutation> { ): AbortableApolloMutationResponse<UpdateCategoryMutation> {
return this.doRequestNew<UpdateCategoryMutation, UpdateCategoryMutationVariables>( return this.doRequestNew<UpdateCategoryMutation, UpdateCategoryMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CATEGORY, UPDATE_CATEGORY,
{ input: { id, patch } }, { input: { id, patch } },
{ refetchQueries: [GET_CATEGORY, GET_CATEGORIES] }, { refetchQueries: [GET_CATEGORY, GET_CATEGORIES], ...options },
); );
} }
@@ -1401,12 +1438,13 @@ export class RequestManager {
categoryId: number, categoryId: number,
key: string, key: string,
value: any, value: any,
options?: MutationOptions<SetCategoryMetadataMutation, SetCategoryMetadataMutationVariables>,
): AbortableApolloMutationResponse<SetCategoryMetadataMutation> { ): AbortableApolloMutationResponse<SetCategoryMetadataMutation> {
return this.doRequestNew<SetCategoryMetadataMutation, SetCategoryMetadataMutationVariables>( return this.doRequestNew<SetCategoryMetadataMutation, SetCategoryMetadataMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
SET_CATEGORY_METADATA, SET_CATEGORY_METADATA,
{ input: { meta: { categoryId, key, value: `${value}` } } }, { input: { meta: { categoryId, key, value: `${value}` } } },
{ refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY, GET_CATEGORIES] }, { refetchQueries: [GET_MANGA, GET_MANGAS, GET_CATEGORY, GET_CATEGORIES], ...options },
); );
} }
@@ -1433,78 +1471,97 @@ export class RequestManager {
return this.getValidUrlFor('backup/export/file'); return this.getValidUrlFor('backup/export/file');
} }
public startDownloads(): AbortableApolloMutationResponse<StartDownloaderMutation> { public startDownloads(
options?: MutationOptions<StartDownloaderMutation, StartDownloaderMutationVariables>,
): AbortableApolloMutationResponse<StartDownloaderMutation> {
return this.doRequestNew<StartDownloaderMutation, StartDownloaderMutationVariables>( return this.doRequestNew<StartDownloaderMutation, StartDownloaderMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
START_DOWNLOADER, START_DOWNLOADER,
{}, {},
options,
); );
} }
public stopDownloads(): AbortableApolloMutationResponse<StopDownloaderMutation> { public stopDownloads(
options?: MutationOptions<StopDownloaderMutation, StopDownloaderMutationVariables>,
): AbortableApolloMutationResponse<StopDownloaderMutation> {
return this.doRequestNew<StopDownloaderMutation, StopDownloaderMutationVariables>( return this.doRequestNew<StopDownloaderMutation, StopDownloaderMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
STOP_DOWNLOADER, STOP_DOWNLOADER,
{}, {},
options,
); );
} }
public clearDownloads(): AbortableApolloMutationResponse<ClearDownloaderMutation> { public clearDownloads(
options?: MutationOptions<ClearDownloaderMutation, ClearDownloaderMutationVariables>,
): AbortableApolloMutationResponse<ClearDownloaderMutation> {
return this.doRequestNew<ClearDownloaderMutation, ClearDownloaderMutationVariables>( return this.doRequestNew<ClearDownloaderMutation, ClearDownloaderMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
CLEAR_DOWNLOADER, CLEAR_DOWNLOADER,
{}, {},
{ refetchQueries: [GET_DOWNLOAD_STATUS] }, { refetchQueries: [GET_DOWNLOAD_STATUS], ...options },
); );
} }
public addChapterToDownloadQueue(id: number): AbortableApolloMutationResponse<EnqueueChapterDownloadMutation> { public addChapterToDownloadQueue(
id: number,
options?: MutationOptions<EnqueueChapterDownloadMutation, EnqueueChapterDownloadMutationVariables>,
): AbortableApolloMutationResponse<EnqueueChapterDownloadMutation> {
return this.doRequestNew<EnqueueChapterDownloadMutation, EnqueueChapterDownloadMutationVariables>( return this.doRequestNew<EnqueueChapterDownloadMutation, EnqueueChapterDownloadMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
ENQUEUE_CHAPTER_DOWNLOAD, ENQUEUE_CHAPTER_DOWNLOAD,
{ input: { id } }, { input: { id } },
{ refetchQueries: [GET_DOWNLOAD_STATUS] }, { refetchQueries: [GET_DOWNLOAD_STATUS], ...options },
); );
} }
public removeChapterFromDownloadQueue(id: number): AbortableApolloMutationResponse<DequeueChapterDownloadMutation> { public removeChapterFromDownloadQueue(
id: number,
options?: MutationOptions<DequeueChapterDownloadMutation, DequeueChapterDownloadMutationVariables>,
): AbortableApolloMutationResponse<DequeueChapterDownloadMutation> {
return this.doRequestNew<DequeueChapterDownloadMutation, DequeueChapterDownloadMutationVariables>( return this.doRequestNew<DequeueChapterDownloadMutation, DequeueChapterDownloadMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
DEQUEUE_CHAPTER_DOWNLOAD, DEQUEUE_CHAPTER_DOWNLOAD,
{ input: { id } }, { input: { id } },
{ refetchQueries: [GET_DOWNLOAD_STATUS] }, { refetchQueries: [GET_DOWNLOAD_STATUS], ...options },
); );
} }
public reorderChapterInDownloadQueue( public reorderChapterInDownloadQueue(
chapterId: number, chapterId: number,
position: number, position: number,
options?: MutationOptions<ReorderChapterDownloadMutation, ReorderChapterDownloadMutationVariables>,
): AbortableApolloMutationResponse<ReorderChapterDownloadMutation> { ): AbortableApolloMutationResponse<ReorderChapterDownloadMutation> {
return this.doRequestNew<ReorderChapterDownloadMutation, ReorderChapterDownloadMutationVariables>( return this.doRequestNew<ReorderChapterDownloadMutation, ReorderChapterDownloadMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
REORDER_CHAPTER_DOWNLOAD, REORDER_CHAPTER_DOWNLOAD,
{ input: { chapterId, to: position } }, { input: { chapterId, to: position } },
{ refetchQueries: [GET_DOWNLOAD_STATUS] }, { refetchQueries: [GET_DOWNLOAD_STATUS], ...options },
); );
} }
public addChaptersToDownloadQueue(ids: number[]): AbortableApolloMutationResponse<EnqueueChapterDownloadsMutation> { public addChaptersToDownloadQueue(
ids: number[],
options?: MutationOptions<EnqueueChapterDownloadsMutation, EnqueueChapterDownloadsMutationVariables>,
): AbortableApolloMutationResponse<EnqueueChapterDownloadsMutation> {
return this.doRequestNew<EnqueueChapterDownloadsMutation, EnqueueChapterDownloadsMutationVariables>( return this.doRequestNew<EnqueueChapterDownloadsMutation, EnqueueChapterDownloadsMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
ENQUEUE_CHAPTER_DOWNLOADS, ENQUEUE_CHAPTER_DOWNLOADS,
{ input: { ids } }, { input: { ids } },
{ refetchQueries: [GET_DOWNLOAD_STATUS] }, { refetchQueries: [GET_DOWNLOAD_STATUS], ...options },
); );
} }
public removeChaptersFromDownloadQueue( public removeChaptersFromDownloadQueue(
ids: number[], ids: number[],
options?: MutationOptions<DequeueChapterDownloadsMutation, DequeueChapterDownloadsMutationVariables>,
): AbortableApolloMutationResponse<DequeueChapterDownloadsMutation> { ): AbortableApolloMutationResponse<DequeueChapterDownloadsMutation> {
return this.doRequestNew<DequeueChapterDownloadsMutation, DequeueChapterDownloadsMutationVariables>( return this.doRequestNew<DequeueChapterDownloadsMutation, DequeueChapterDownloadsMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
DEQUEUE_CHAPTER_DOWNLOADS, DEQUEUE_CHAPTER_DOWNLOADS,
{ input: { ids } }, { input: { ids } },
{ refetchQueries: [GET_DOWNLOAD_STATUS] }, { refetchQueries: [GET_DOWNLOAD_STATUS], ...options },
); );
} }
@@ -1541,33 +1598,45 @@ export class RequestManager {
} as typeof result; } as typeof result;
} }
public startGlobalUpdate(): AbortableApolloMutationResponse<UpdateLibraryMangasMutation>; public startGlobalUpdate(
categories?: undefined,
public startGlobalUpdate(categories: number[]): AbortableApolloMutationResponse<UpdateCategoryMangasMutation>; options?: MutationOptions<UpdateLibraryMangasMutation, UpdateLibraryMangasMutationVariables>,
): AbortableApolloMutationResponse<UpdateLibraryMangasMutation>;
public startGlobalUpdate( public startGlobalUpdate(
categories?: number[], categories: number[],
): AbortableApolloMutationResponse<UpdateCategoryMangasMutation | UpdateLibraryMangasMutation> { options?: MutationOptions<UpdateCategoryMangasMutation, UpdateCategoryMangasMutationVariables>,
): AbortableApolloMutationResponse<UpdateCategoryMangasMutation>;
public startGlobalUpdate<
Data extends UpdateLibraryMangasMutation | UpdateCategoryMangasMutation,
Variables extends UpdateLibraryMangasMutationVariables | UpdateCategoryMangasMutationVariables,
>(categories?: number[], options?: MutationOptions<Data, Variables>): AbortableApolloMutationResponse<Data> {
if (categories?.length) { if (categories?.length) {
return this.doRequestNew<UpdateCategoryMangasMutation, UpdateCategoryMangasMutationVariables>( return this.doRequestNew<UpdateCategoryMangasMutation, UpdateCategoryMangasMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CATEGORY_MANGAS, UPDATE_CATEGORY_MANGAS,
{ input: { categories } }, { input: { categories } },
); options as MutationOptions<UpdateCategoryMangasMutation, UpdateCategoryMangasMutationVariables>,
) as AbortableApolloMutationResponse<Data>;
} }
return this.doRequestNew<UpdateLibraryMangasMutation, UpdateLibraryMangasMutationVariables>( return this.doRequestNew<UpdateLibraryMangasMutation, UpdateLibraryMangasMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_LIBRARY_MANGAS, UPDATE_LIBRARY_MANGAS,
{}, {},
); options as MutationOptions<UpdateLibraryMangasMutation, UpdateLibraryMangasMutationVariables>,
) as AbortableApolloMutationResponse<Data>;
} }
public resetGlobalUpdate(): AbortableApolloMutationResponse<StopUpdaterMutation> { public resetGlobalUpdate(
options?: MutationOptions<StopUpdaterMutation, StopUpdaterMutationVariables>,
): AbortableApolloMutationResponse<StopUpdaterMutation> {
return this.doRequestNew<StopUpdaterMutation, StopUpdaterMutationVariables>( return this.doRequestNew<StopUpdaterMutation, StopUpdaterMutationVariables>(
GQLMethod.MUTATION, GQLMethod.MUTATION,
STOP_UPDATER, STOP_UPDATER,
{}, {},
options,
); );
} }