为什么 Google 书籍 API 没有 return 完整的回复?

Why does Google Books API not return a complete response?

我请求 google 本书 API,试图从我的书架上取回书籍(a.k.a 本书)。但是我得到的回复只包含 10 件商品,而在货架上我有 17 件商品。

这可能是我的代码有问题,或者可能是 google 的限制? 查看我的调用代码和映射代码。

我的api.js

import React, { Component } from "react"
import request from 'superagent';
import BookList from './BookList';

class Book extends Component{
    constructor(props){
      super(props);
      this.state = {
        books: [],
      }
    }
     componentDidMount(){
       request.get("https://www.googleapis.com/books/v1/users/101###############/bookshelves/4/volumes?key=AIzaSyDNMnPGw3################-PecbhU")
      .query(null)
      .then((data) =>{
       console.log(data);
        this.setState({books: [...data.body.items]})
        
      })
    
    }
   
   

    render(){
      
      return(
        <div>
              <BookList books={this.state.books}/>
              
        </div>
  
  
      );
    }
    

  }

  export default Book

这里是我的地图

import React, { Component } from "react"
import BookCard from './bookcard';

const BookList = (props) => {
    if(!props){
        return null;
    }
    return(
       <div>
            {
                props && props.books?.map((book, i) => {
                    return <div class="grid-container">
                    <BookCard
                    key={i}
                        image={book.volumeInfo.imageLinks.thumbnail}
                        title={book.volumeInfo.title}
                        author={book.volumeInfo.authors}
                        url={book.volumeInfo.canonicalVolumeLink}
                        rating={book.volumeInfo.averageRating}
                    
                    />
                    </div>
                    
                })
            }
        </div>
    )
}

 export default BookList

作为the docs say:

Pagination

You can paginate the volumes list by specifying two values in the parameters for the request:

startIndex - The position in the collection at which to start. The index of the first item is 0.

maxResults - The maximum number of results to return. The default is 10, and the maximum allowable value is 40.

因此,您可以将 maxResults=40 添加到您的查询中,以便一次获得更多结果。