query GetChapter($id: Int!) {
  chapter(id: $id) {
    ...ChapterFragment
  }
}

query GetMangaChapters($id: Int!) {
  chapters(
    condition: {mangaId: $id}
    orderBy: SOURCE_ORDER,
    orderByType: DESC,
  ) {
    nodes {
      ...ChapterFragment
    }
  }
}

mutation UpdateChapter($id: Int!, $patch: UpdateChapterPatchInput!) {
  updateChapter(input: {id: $id, patch: $patch}) {
    clientMutationId
  }
}

mutation UpdateChapters($id: [Int!]!, $patch: UpdateChapterPatchInput!) {
  updateChapters(input: {ids: $id, patch: $patch}) {
    clientMutationId
  }
}

mutation UpdateChapterMeta($id: Int!, $key: String!, $value: String!) {
  setChapterMeta(input: {meta: {chapterId: $id, key: $key, value: $value}}) {
    clientMutationId
  }
}

mutation DeleteDownloadedChapter($id: Int!) {
  deleteDownloadedChapter(input: {id: $id}) {
    clientMutationId
  }
}

mutation DeleteDownloadedChapters($ids: [Int!]!) {
  deleteDownloadedChapters(input: {ids: $ids}) {
    clientMutationId
  }
}

mutation FetchChapters($mangaId: Int!) {
  fetchChapters(input: {mangaId: $mangaId}) {
    chapters {
      ...ChapterFragment
    }
  }
}

mutation FetchChapterPages($id: Int!) {
  fetchChapterPages(input: {chapterId: $id}) {
    pages
  }
}
