Create queries, mutations and subscriptions
This commit is contained in:
30
src/lib/graphql/queries/BackupQuery.ts
Normal file
30
src/lib/graphql/queries/BackupQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
73
src/lib/graphql/queries/CategoryQuery.ts
Normal file
73
src/lib/graphql/queries/CategoryQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
57
src/lib/graphql/queries/ChapterQuery.ts
Normal file
57
src/lib/graphql/queries/ChapterQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
20
src/lib/graphql/queries/DownloaderQuery.ts
Normal file
20
src/lib/graphql/queries/DownloaderQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
57
src/lib/graphql/queries/ExtensionQuery.ts
Normal file
57
src/lib/graphql/queries/ExtensionQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
55
src/lib/graphql/queries/GlobalMetadataQuery.ts
Normal file
55
src/lib/graphql/queries/GlobalMetadataQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
59
src/lib/graphql/queries/MangaQuery.ts
Normal file
59
src/lib/graphql/queries/MangaQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
52
src/lib/graphql/queries/ServerInfoQuery.ts
Normal file
52
src/lib/graphql/queries/ServerInfoQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
20
src/lib/graphql/queries/SettingsQuery.ts
Normal file
20
src/lib/graphql/queries/SettingsQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
30
src/lib/graphql/queries/SourceQuery.ts
Normal file
30
src/lib/graphql/queries/SourceQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
28
src/lib/graphql/queries/UpdaterQuery.ts
Normal file
28
src/lib/graphql/queries/UpdaterQuery.ts
Normal 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
|
||||
}
|
||||
}
|
||||
`;
|
||||
Reference in New Issue
Block a user