import 'rxjs/add/operator/map' ; import { Injectable } from '@angular/core' ; import { Http } from '@angular/http' ; import { Observable } from 'rxjs/Observable' ; import { Model } from 'ngrx-domains' ; @ Injectable ( ) export class GoogleBooksService { private API_PATH : string = 'https://www.googleapis.com/books/v1/volumes' ; constructor ( private http ) { } searchBooks ( queryTitle ) { return this . http . get ( `${ this . API_PATH }?q=${ queryTitle }` ) . map ( res => res . json ( ) . items || [ ] ) ; } retrieveBook ( volumeId ) { return this . http . get ( `${ this . API_PATH }/${ volumeId }` ) . map ( res => res . json ( ) ) ; } }