Create queries, mutations and subscriptions

This commit is contained in:
schroda
2023-08-05 01:03:40 +02:00
parent ae5d2525f1
commit 55c1c51edd
26 changed files with 1675 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
export const CREATE_BACKUP = gql`
mutation CREATE_BACKUP($input: CreateBackupInput!) {
createBackup(input: $input) {
clientMutationId
url
}
}
`;
export const RESTORE_BACKUP = gql`
mutation RESTORE_BACKUP($input: RestoreBackupInput!) {
restoreBackup(input: $input) {
clientMutationId
status {
mangaProgress
state
totalManga
}
}
}
`;

View File

@@ -0,0 +1,105 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_CATEGORY_FIELDS } from '@/lib/graphql/Fragments';
export const CREATE_CATEGORY = gql`
${FULL_CATEGORY_FIELDS}
mutation CREATE_CATEGORY($input: CreateCategoryInput!) {
createCategory(input: $input) {
clientMutationId
category {
...FULL_CATEGORY_FIELDS
}
}
}
`;
export const DELETE_CATEGORY = gql`
${FULL_CATEGORY_FIELDS}
mutation DELETE_CATEGORY($input: DeleteCategoryInput!) {
deleteCategory(input: $input) {
clientMutationId
category {
...FULL_CATEGORY_FIELDS
}
}
}
`;
export const DELETE_CATEGORY_METADATA = gql`
${FULL_CATEGORY_FIELDS}
mutation DELETE_CATEGORY_METADATA($input: DeleteCategoryMetaInput!) {
deleteCategoryMeta(input: $input) {
clientMutationId
meta {
key
value
category {
...FULL_CATEGORY_FIELDS
}
}
category {
...FULL_CATEGORY_FIELDS
}
}
}
`;
export const SET_CATEGORY_METADATA = gql`
${FULL_CATEGORY_FIELDS}
mutation SET_CATEGORY_METADATA($input: SetCategoryMetaInput!) {
setCategoryMeta(input: $input) {
clientMutationId
meta {
key
value
category {
...FULL_CATEGORY_FIELDS
}
}
}
}
`;
export const UPDATE_CATEGORY = gql`
${FULL_CATEGORY_FIELDS}
mutation UPDATE_CATEGORY($input: UpdateCategoryInput!) {
updateCategory(input: $input) {
clientMutationId
category {
...FULL_CATEGORY_FIELDS
}
}
}
`;
export const UPDATE_CATEGORIES = gql`
${FULL_CATEGORY_FIELDS}
mutation UPDATE_CATEGORIES($input: UpdateCategoriesInput!) {
updateCategories(input: $input) {
clientMutationId
categories {
...FULL_CATEGORY_FIELDS
}
}
}
`;
export const UPDATE_CATEGORY_ORDER = gql`
${FULL_CATEGORY_FIELDS}
mutation UPDATE_CATEGORY_ORDER($input: UpdateCategoryOrderInput!) {
updateCategoryOrder(input: $input) {
clientMutationId
categories {
...FULL_CATEGORY_FIELDS
}
}
}
`;

View File

@@ -0,0 +1,96 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_CHAPTER_FIELDS } from '@/lib/graphql/Fragments';
export const DELETE_CHAPTER_METADATA = gql`
${FULL_CHAPTER_FIELDS}
mutation DELETE_CHAPTER_METADATA($input: DeleteChapterMetaInput!) {
deleteChapterMeta(input: $input) {
clientMutationId
meta {
key
value
chapter {
...FULL_CHAPTER_FIELDS
}
}
chapter {
...FULL_CHAPTER_FIELDS
}
}
}
`;
// makes the server fetch and return the pages of a chapter
export const GET_CHAPTER_PAGES_FETCH = gql`
${FULL_CHAPTER_FIELDS}
mutation GET_CHAPTER_PAGES_FETCH($input: FetchChapterPagesInput!) {
fetchChapterPages(input: $input) {
clientMutationId
chapter {
...FULL_CHAPTER_FIELDS
}
pages
}
}
`;
// makes the server fetch and return the chapters of the manga
export const GET_MANGA_CHAPTERS_FETCH = gql`
${FULL_CHAPTER_FIELDS}
mutation GET_MANGA_CHAPTERS_FETCH($input: FetchChaptersInput!) {
fetchChapters(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
}
}
}
`;
export const SET_CHAPTER_METADATA = gql`
${FULL_CHAPTER_FIELDS}
mutation SET_CHAPTER_METADATA($input: SetChapterMetaInput!) {
setChapterMeta(input: $input) {
clientMutationId
meta {
key
value
chapter {
...FULL_CHAPTER_FIELDS
}
}
}
}
`;
export const UPDATE_CHAPTER = gql`
${FULL_CHAPTER_FIELDS}
mutation UPDATE_CHAPTER($input: UpdateChapterInput!) {
updateChapter(input: $input) {
clientMutationId
chapter {
...FULL_CHAPTER_FIELDS
}
}
}
`;
export const UPDATE_CHAPTERS = gql`
${FULL_CHAPTER_FIELDS}
mutation UPDATE_CHAPTERS($input: UpdateChaptersInput!) {
updateChapters(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
}
}
}
`;

View File

@@ -0,0 +1,130 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_CHAPTER_FIELDS, FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments';
export const CLEAR_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS}
mutation CLEAR_DOWNLOADER($input: ClearDownloaderInput = {}) {
clearDownloader(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const DELETE_DOWNLOADED_CHAPTER = gql`
${FULL_CHAPTER_FIELDS}
mutation DELETE_DOWNLOADED_CHAPTER($input: DeleteDownloadedChapterInput!) {
deleteDownloadedChapter(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
}
}
}
`;
export const DELETE_DOWNLOADED_CHAPTERS = gql`
${FULL_CHAPTER_FIELDS}
mutation DELETE_DOWNLOADED_CHAPTERS($input: DeleteDownloadedChaptersInput!) {
deleteDownloadedChapters(input: $input) {
clientMutationId
chapters {
...FULL_CHAPTER_FIELDS
}
}
}
`;
export const DEQUEUE_CHAPTER_DOWNLOAD = gql`
${FULL_DOWNLOAD_STATUS}
mutation DEQUEUE_CHAPTER_DOWNLOAD($input: DequeueChapterDownloadInput!) {
dequeueChapterDownload(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const DEQUEUE_CHAPTER_DOWNLOADS = gql`
${FULL_DOWNLOAD_STATUS}
mutation DEQUEUE_CHAPTER_DOWNLOADS($input: DequeueChapterDownloadsInput!) {
dequeueChapterDownloads(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const ENQUEUE_CHAPTER_DOWNLOAD = gql`
${FULL_DOWNLOAD_STATUS}
mutation ENQUEUE_CHAPTER_DOWNLOAD($input: EnqueueChapterDownloadInput!) {
enqueueChapterDownload(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const ENQUEUE_CHAPTER_DOWNLOADS = gql`
${FULL_DOWNLOAD_STATUS}
mutation ENQUEUE_CHAPTER_DOWNLOADS($input: EnqueueChapterDownloadsInput!) {
enqueueChapterDownloads(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const REORDER_CHAPTER_DOWNLOAD = gql`
${FULL_DOWNLOAD_STATUS}
mutation REORDER_CHAPTER_DOWNLOAD($input: ReorderChapterDownloadInput!) {
reorderChapterDownload(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const START_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS}
mutation START_DOWNLOADER($input: StartDownloaderInput = {}) {
startDownloader(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;
export const STOP_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS}
mutation STOP_DOWNLOADER($input: StopDownloaderInput = {}) {
stopDownloader(input: $input) {
clientMutationId
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
}
`;

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_EXTENSION_FIELDS } from '@/lib/graphql/Fragments';
// makes the server fetch and return the latest extensions
export const GET_EXTENSIONS_FETCH = gql`
${FULL_EXTENSION_FIELDS}
mutation GET_EXTENSIONS_FETCH($input: FetchExtensionsInput = {}) {
fetchExtensions(input: $input) {
clientMutationId
extensions {
...FULL_EXTENSION_FIELDS
}
}
}
`;
export const UPDATE_EXTENSION = gql`
${FULL_EXTENSION_FIELDS}
mutation UPDATE_EXTENSION($input: UpdateExtensionInput!) {
updateExtension(input: $input) {
clientMutationId
extension {
...FULL_EXTENSION_FIELDS
}
}
}
`;
export const UPDATE_EXTENSIONS = gql`
${FULL_EXTENSION_FIELDS}
mutation UPDATE_EXTENSIONS($input: UpdateExtensionsInput!) {
updateExtensions(input: $input) {
clientMutationId
extensions {
...FULL_EXTENSION_FIELDS
}
}
}
`;
export const INSTALL_EXTERNAL_EXTENSION = gql`
${FULL_EXTENSION_FIELDS}
mutation INSTALL_EXTERNAL_EXTENSION($file: Upload!) {
installExternalExtension(input: { extensionFile: $file }) {
extension {
...FULL_EXTENSION_FIELDS
}
clientMutationId
}
}
`;

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { GLOBAL_METADATA } from '@/lib/graphql/Fragments';
export const DELETE_GLOBAL_METADATA = gql`
${GLOBAL_METADATA}
mutation DELETE_GLOBAL_METADATA($input: DeleteGlobalMetaInput!) {
deleteGlobalMeta(input: $input) {
clientMutationId
meta {
...GLOBAL_METADATA
}
}
}
`;
export const SET_GLOBAL_METADATA = gql`
${GLOBAL_METADATA}
mutation SET_GLOBAL_METADATA($input: SetGlobalMetaInput!) {
setGlobalMeta(input: $input) {
clientMutationId
meta {
...GLOBAL_METADATA
}
}
}
`;

View File

@@ -0,0 +1,106 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_MANGA_FIELDS } from '@/lib/graphql/Fragments';
export const DELETE_MANGA_METADATA = gql`
${FULL_MANGA_FIELDS}
mutation DELETE_MANGA_METADATA($input: DeleteMangaMetaInput!) {
deleteMangaMeta(input: $input) {
clientMutationId
meta {
key
value
manga {
...FULL_MANGA_FIELDS
}
}
manga {
...FULL_MANGA_FIELDS
}
}
}
`;
// makes the server fetch and return the manga
export const GET_MANGA_FETCH = gql`
${FULL_MANGA_FIELDS}
mutation GET_MANGA_FETCH($input: FetchMangaInput!) {
fetchManga(input: $input) {
clientMutationId
manga {
...FULL_MANGA_FIELDS
}
}
}
`;
export const SET_MANGA_METADATA = gql`
${FULL_MANGA_FIELDS}
mutation SET_MANGA_METADATA($input: SetMangaMetaInput!) {
setMangaMeta(input: $input) {
clientMutationId
meta {
key
value
manga {
...FULL_MANGA_FIELDS
}
}
}
}
`;
export const UPDATE_MANGA = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGA($input: UpdateMangaInput!) {
updateManga(input: $input) {
clientMutationId
manga {
...FULL_MANGA_FIELDS
}
}
}
`;
export const UPDATE_MANGA_CATEGORIES = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGA_CATEGORIES($input: UpdateMangaCategoriesInput!) {
updateMangaCategories(input: $input) {
clientMutationId
manga {
...FULL_MANGA_FIELDS
}
}
}
`;
export const UPDATE_MANGAS = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGAS($input: UpdateMangasInput!) {
updateMangas(input: $input) {
clientMutationId
mangas {
...FULL_MANGA_FIELDS
}
}
}
`;
export const UPDATE_MANGAS_CATEGORIES = gql`
${FULL_MANGA_FIELDS}
mutation UPDATE_MANGAS_CATEGORIES($input: UpdateMangasCategoriesInput!) {
updateMangasCategories(input: $input) {
clientMutationId
mangas {
...FULL_MANGA_FIELDS
}
}
}
`;

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { WEBUI_UPDATE_STATUS } from '@/lib/graphql/Fragments';
// eslint-disable-next-line import/prefer-default-export
export const UPDATE_WEBUI = gql`
${WEBUI_UPDATE_STATUS}
mutation UPDATE_WEBUI($input: WebUIUpdateInput = {}) {
updateWebUI(input: $input) {
clientMutationId
updateStatus {
...WEBUI_UPDATE_STATUS
}
}
}
`;

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { SERVER_SETTINGS } from '@/lib/graphql/Fragments';
export const RESET_SERVER_SETTINGS = gql`
${SERVER_SETTINGS}
mutation RESET_SERVER_SETTINGS($input: ResetSettingsInput!) {
resetSettings(input: $input) {
clientMutationId
settings {
...SERVER_SETTINGS
}
}
}
`;
export const UPDATE_SERVER_SETTINGS = gql`
${SERVER_SETTINGS}
mutation UPDATE_SERVER_SETTINGS($input: SetSettingsInput!) {
setSettings(input: $input) {
clientMutationId
settings {
...SERVER_SETTINGS
}
}
}
`;

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_MANGA_FIELDS, FULL_SOURCE_FIELDS } from '@/lib/graphql/Fragments';
export const GET_SOURCE_MANGAS_FETCH = gql`
${FULL_MANGA_FIELDS}
mutation GET_SOURCE_MANGAS_FETCH($input: FetchSourceMangaInput!) {
fetchSourceManga(input: $input) {
clientMutationId
hasNextPage
mangas {
...FULL_MANGA_FIELDS
}
}
}
`;
export const UPDATE_SOURCE_PREFERENCES = gql`
${FULL_SOURCE_FIELDS}
mutation UPDATE_SOURCE_PREFERENCES($input: UpdateSourcePreferenceInput!) {
updateSourcePreference(input: $input) {
clientMutationId
source {
...FULL_SOURCE_FIELDS
}
}
}
`;

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { PARTIAL_UPDATER_STATUS } from '@/lib/graphql/Fragments';
export const UPDATE_CATEGORY_MANGAS = gql`
${PARTIAL_UPDATER_STATUS}
mutation UPDATE_CATEGORY_MANGAS($input: UpdateCategoryMangaInput!) {
updateCategoryManga(input: $input) {
clientMutationId
updateStatus {
...PARTIAL_UPDATER_STATUS
}
}
}
`;
export const UPDATE_LIBRARY_MANGAS = gql`
${PARTIAL_UPDATER_STATUS}
mutation UPDATE_LIBRARY_MANGAS($input: UpdateLibraryMangaInput = {}) {
updateLibraryManga(input: $input) {
clientMutationId
updateStatus {
...PARTIAL_UPDATER_STATUS
}
}
}
`;
export const STOP_UPDATER = gql`
mutation STOP_UPDATER($input: UpdateStopInput = {}) {
updateStop(input: $input) {
clientMutationId
}
}
`;