Salta ai contenuti

Lists

Questi contenuti non sono ancora disponibili nella tua lingua.

Ultimo Aggiornamento   6 giugno 2025

Reference

What is a List?

Lists in Hardcover are user-created collections of books organized around themes, genres, or personal preferences. Users can create public or private lists to organize and share their reading recommendations with the community.

Fields

FieldTypeDescription
idintUnique identifier for the list
namestringThe title/name of the list
descriptionstringDescription of the list’s purpose or theme
slugstringURL-friendly identifier for the list
books_countintTotal number of books in the list
likes_countintNumber of users who have liked this list
publicboolWhether the list is publicly visible
privacy_setting_idintPrivacy setting for the list: 1 = public, 2 = followers only, 3 = private
user_idintID of the user who created the list
created_attimestampWhen the list was created
updated_attimestampWhen the list was last modified
userUserUser object of the list creator
list_booksListBook[]Array of books associated with this list

Related Schemas

  • Books - Books that can be added to lists
  • Users - Users who create and interact with lists

Example Queries

Get All Public Lists

Retrieve the top 10 most-liked public lists.

Public Lists Query
query GetPublicLists {
lists(
where: {public: {_eq: true}}
order_by: {likes_count: desc}
limit: 10
) {
id
name
description
books_count
likes_count
user {
username
}
}
}

Get Lists by a Specific User

Get all lists created by a specific user. Replace ##USER_ID## with the actual user ID.

User Lists Query
query GetUserLists {
lists(
where: {user_id: {_eq: ##USER_ID##}}
order_by: {updated_at: desc}
) {
id
name
description
books_count
public
created_at
updated_at
}
}

Get Books in a Specific List

Get all books in a specific list with their details.

This example uses NPR Top 100 Science Fiction Fantasy list (ID: 3).

List Books Query
query GetListBooks {
lists(where: {id: {_eq: 3}}) {
name
description
list_books {
book {
id
title
contributions {
author {
name
}
}
rating
pages
}
position
date_added
}
}
}

Create a New List

Create a new list with name, description, and privacy setting.

Privacy settings:

  • 1 = public
  • 2 = followers only
  • 3 = private
Create List Mutation
mutation CreateList {
insert_list(
object: {
name: "My Favorite Sci-Fi Books"
description: "A collection of the best science fiction novels I've read"
privacy_setting_id: 1
}
) {
list {
id
name
description
public
created_at
}
}
}

Add a Book to a List

Add a book to your own list.

Add Book to List
mutation AddBookToList {
insert_list_book(
object: {
list_id: 27818
book_id: 456
position: 1
}
) {
list_book {
id
list_id
book_id
position
date_added
}
}
}