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,30 @@
/*
* 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 VALIDATE_BACKUP = gql`
query VALIDATE_BACKUP($input: ValidateBackupInput!) {
validateBackup(input: $input) {
missingSources {
id
name
}
}
}
`;
export const GET_RESTORE_STATUS = gql`
query GET_RESTORE_STATUS {
restoreStatus {
mangaProgress
state
totalManga
}
}
`;

View File

@@ -0,0 +1,73 @@
/*
* 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, FULL_MANGA_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments';
export const GET_CATEGORIES = gql`
${FULL_CATEGORY_FIELDS}
${PAGE_INFO}
query GET_CATEGORIES(
$after: Cursor
$before: Cursor
$condition: CategoryConditionInput
$filter: CategoryFilterInput
$first: Int
$last: Int
$offset: Int
$orderBy: CategoryOrderBy
$orderByType: SortOrder
) {
categories(
after: $after
before: $before
condition: $condition
filter: $filter
first: $first
last: $last
offset: $offset
orderBy: $orderBy
orderByType: $orderByType
) {
nodes {
...FULL_CATEGORY_FIELDS
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
`;
export const GET_CATEGORY = gql`
${FULL_CATEGORY_FIELDS}
query GET_CATEGORY($id: Int!) {
category(id: $id) {
...FULL_CATEGORY_FIELDS
}
}
`;
export const GET_CATEGORY_MANGAS = gql`
${FULL_MANGA_FIELDS}
${PAGE_INFO}
query GET_CATEGORY_MANGAS($id: Int!) {
category(id: $id) {
mangas {
nodes {
...FULL_MANGA_FIELDS
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
}
`;

View File

@@ -0,0 +1,57 @@
/*
* 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, PAGE_INFO } from '@/lib/graphql/Fragments';
// returns the current chapter from the database
export const GET_CHAPTER = gql`
${FULL_CHAPTER_FIELDS}
query GET_CHAPTER($id: Int!) {
chapter(id: $id) {
...FULL_CHAPTER_FIELDS
}
}
`;
// returns the current chapters from the database
export const GET_CHAPTERS = gql`
${FULL_CHAPTER_FIELDS}
${PAGE_INFO}
query GET_CHAPTERS(
$after: Cursor
$before: Cursor
$condition: ChapterConditionInput
$filter: ChapterFilterInput
$first: Int
$last: Int
$offset: Int
$orderBy: ChapterOrderBy
$orderByType: SortOrder
) {
chapters(
after: $after
before: $before
condition: $condition
filter: $filter
first: $first
last: $last
offset: $offset
orderBy: $orderBy
orderByType: $orderByType
) {
nodes {
...FULL_CHAPTER_FIELDS
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
`;

View File

@@ -0,0 +1,20 @@
/*
* 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_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments';
// eslint-disable-next-line import/prefer-default-export
export const GET_DOWNLOAD_STATUS = gql`
${FULL_DOWNLOAD_STATUS}
query GET_DOWNLOAD_STATUS {
downloadStatus {
...FULL_DOWNLOAD_STATUS
}
}
`;

View File

@@ -0,0 +1,57 @@
/*
* 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, PAGE_INFO } from '@/lib/graphql/Fragments';
// returns the current extension from the database
export const GET_EXTENSION = gql`
${FULL_EXTENSION_FIELDS}
query GET_EXTENSION($pkgName: String!) {
extension(pkgName: $pkgName) {
...FULL_EXTENSION_FIELDS
}
}
`;
// returns the current extensions from the database
export const GET_EXTENSIONS = gql`
${FULL_EXTENSION_FIELDS}
${PAGE_INFO}
query GET_EXTENSIONS(
$after: Cursor
$before: Cursor
$condition: ExtensionConditionInput
$filter: ExtensionFilterInput
$first: Int
$last: Int
$offset: Int
$orderBy: ExtensionOrderBy
$orderByType: SortOrder
) {
extensions(
after: $after
before: $before
condition: $condition
filter: $filter
first: $first
last: $last
offset: $offset
orderBy: $orderBy
orderByType: $orderByType
) {
nodes {
...FULL_EXTENSION_FIELDS
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
`;

View File

@@ -0,0 +1,55 @@
/*
* 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, PAGE_INFO } from '@/lib/graphql/Fragments.ts';
export const GET_GLOBAL_METADATA = gql`
${GLOBAL_METADATA}
query GET_GLOBAL_METADATA($key: String!) {
meta(key: $key) {
...GLOBAL_METADATA
}
}
`;
export const GET_GLOBAL_METADATAS = gql`
${GLOBAL_METADATA}
${PAGE_INFO}
query GET_GLOBAL_METADATAS(
$after: Cursor
$before: Cursor
$condition: MetaConditionInput
$filter: MetaFilterInput
$first: Int
$last: Int
$offset: Int
$orderBy: MetaOrderBy
$orderByType: SortOrder
) {
metas(
after: $after
before: $before
condition: $condition
filter: $filter
first: $first
last: $last
offset: $offset
orderBy: $orderBy
orderByType: $orderByType
) {
nodes {
...GLOBAL_METADATA
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
`;

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_CHAPTER_FIELDS, FULL_MANGA_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments';
// returns the current manga from the database
export const GET_MANGA = gql`
${FULL_MANGA_FIELDS}
${FULL_CHAPTER_FIELDS}
query GET_MANGA($id: Int!) {
manga(id: $id) {
...FULL_MANGA_FIELDS
}
}
`;
// returns the current manga from the database
export const GET_MANGAS = gql`
${FULL_MANGA_FIELDS}
${FULL_CHAPTER_FIELDS}
${PAGE_INFO}
query GET_MANGAS(
$after: Cursor
$before: Cursor
$condition: MangaConditionInput
$filter: MangaFilterInput
$first: Int
$last: Int
$offset: Int
$orderBy: MangaOrderBy
$orderByType: SortOrder
) {
mangas(
after: $after
before: $before
condition: $condition
filter: $filter
first: $first
last: $last
offset: $offset
orderBy: $orderBy
orderByType: $orderByType
) {
nodes {
...FULL_MANGA_FIELDS
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
`;

View File

@@ -0,0 +1,52 @@
/*
* 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_INFO, WEBUI_UPDATE_STATUS } from '@/lib/graphql/Fragments';
export const GET_ABOUT = gql`
query GET_ABOUT {
about {
buildTime
buildType
discord
github
name
revision
version
}
}
`;
export const CHECK_FOR_SERVER_UPDATES = gql`
query CHECK_FOR_SERVER_UPDATES {
checkForServerUpdates {
channel
tag
url
}
}
`;
export const CHECK_FOR_WEBUI_UPDATE = gql`
${WEBUI_UPDATE_INFO}
query CHECK_FOR_WEBUI_UPDATE {
checkForWebUIUpdate {
...WEBUI_UPDATE_INFO
}
}
`;
export const GET_WEBUI_UPDATE_STATUS = gql`
${WEBUI_UPDATE_STATUS}
query GET_WEBUI_UPDATE_STATUS {
getWebUIUpdateStatus {
...WEBUI_UPDATE_STATUS
}
}
`;

View File

@@ -0,0 +1,20 @@
/*
* 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';
// eslint-disable-next-line import/prefer-default-export
export const GET_SERVER_SETTINGS = gql`
${SERVER_SETTINGS}
query GET_SERVER_SETTINGS {
settings {
...SERVER_SETTINGS
}
}
`;

View File

@@ -0,0 +1,30 @@
/*
* 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_SOURCE_FIELDS, PARTIAL_SOURCE_FIELDS } from '@/lib/graphql/Fragments';
export const GET_SOURCE = gql`
${FULL_SOURCE_FIELDS}
query GET_SOURCE($id: LongString!) {
source(id: $id) {
...FULL_SOURCE_FIELDS
}
}
`;
export const GET_SOURCES = gql`
${PARTIAL_SOURCE_FIELDS}
query GET_SOURCES {
sources {
nodes {
...PARTIAL_SOURCE_FIELDS
}
}
}
`;

View File

@@ -0,0 +1,28 @@
/*
* 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_UPDATER_STATUS } from '@/lib/graphql/Fragments';
// eslint-disable-next-line import/prefer-default-export
export const GET_UPDATE_STATUS = gql`
${FULL_UPDATER_STATUS}
query GET_UPDATE_STATUS {
updateStatus {
...FULL_UPDATER_STATUS
}
}
`;
export const GET_LAST_UPDATE_TIMESTAMP = gql`
query GET_LAST_UPDATE_TIMESTAMP {
lastUpdateTimestamp {
timestamp
}
}
`;