Saltearse al contenido

Books

Last updated on December 29, 2024

Reference

Get a list of books belonging to the current user

Example Query
{
list_books(
where: {
user_books: {
user_id: {_eq: ##USER_ID##}
}
},
distinct_on: book_id
limit: 5
offset: 0
) {
book {
title
pages
release_date
}
}
}

Get a list of books by a specific author

Example Query
query BooksByUserCount {
books(
where: {
contributions: {
author: {
name: {_eq: "Brandon Sanderson"}
}
}
}
limit: 10
order_by: {users_count: desc}
) {
pages
title
id
}
}

Getting All Editions of a Book

Example Query
query GetEditionsFromTitle {
editions(where: {title: {_eq: "Oathbringer"}}) {
id
title
edition_format
pages
release_date
isbn_10
isbn_13
publisher {
name
}
}
}

Create a new book

Example Query
mutation {
createBook(input: {
title: "My First Book",
pages: 300,
release_date: "2024-09-07"
description: "This is my first book."
}) {
book {
title
pages
release_date
description
}
}
}