Google Books Search With C#

Google Books is our effort to make book content more discoverable on the Web. Using the Google Books API, your application can perform full-text searches and retrieve book information, viewability and eBook availability.
https://developers.google.com/books/

Install package Google.Apis.Books.v1.1 from nuget
Install-Package Google.Apis.Books.v1

Create a C# project, MVC application will do;

Create a class in the project, let’s call it BookApi class,
  1. public class BookModel  
  2. {  
  3.     public string Id {  
  4.         get;  
  5.         set;  
  6.     }  
  7.     public string Title {  
  8.         get;  
  9.         set;  
  10.     }  
  11.     public string Subtitle {  
  12.         get;  
  13.         set;  
  14.     }  
  15.     public string Description {  
  16.         get;  
  17.         set;  
  18.     }  
  19.     public int ? PageCount {  
  20.         get;  
  21.         set;  
  22.     }  
  23. }  
  24. public class BookApi {  
  25.     private readonly BooksService _booksService;  
  26.     public BookApi(string apiKey) {  
  27.         _booksService = new BooksService(new BaseClientService.Initializer() {  
  28.             ApiKey = apiKey,  
  29.                 ApplicationName = this.GetType().ToString()  
  30.         });  
  31.     }  
  32.     public Tuple < int ? , List < BookModel >> Search(string query, int offset, int count) {  
  33.         var listquery = _booksService.Volumes.List(query);  
  34.         listquery.MaxResults = count;  
  35.         listquery.StartIndex = offset;  
  36.         var res = listquery.Execute();  
  37.         var books = res.Items.Select(b => new BookModel {  
  38.             Id = b.Id,  
  39.                 Title = b.VolumeInfo.Title,  
  40.                 Subtitle = b.VolumeInfo.Subtitle,  
  41.                 Description = b.VolumeInfo.Description,  
  42.                 PageCount = b.VolumeInfo.PageCount,  
  43.         }).ToList();  
  44.         return new Tuple < int ? , List < BookModel >> (res.TotalItems, books);  
  45.     }