Skip to content

Latest commit

 

History

History
114 lines (87 loc) · 2.14 KB

README.md

File metadata and controls

114 lines (87 loc) · 2.14 KB

googlebooksapi

A wrapper of the Google Books APIs written in Kotlin

Usage

Volumes

val volumeHelper = VolumeHelper("API_KEY")
Get volumes
val request = VolumeGetRequest().apply {
    search("Plants")
    intitle("This is your mind on plants")
    inpublisher("Penguin")
    inauthor("Michael Pollan")
    langRestrict("en")
    maxResults(1)
    orderBy(SortOption.NEWEST)
    printType(PrintTypeOption.BOOKS)
    projection(ProjectionOption.LITE)
    startIndex(0)
}

val volumes: Volume = volumeHelper.get(request)
Get specific volume
val request = VolumeGetIDRequest().apply {
    volumeID("zKkdEAAAQBAJ")
    projection(ProjectionOption.LITE)
}

val volume: VolumeItem = volumeHelper.getVolumeWithID(request)

Bookshelves

val bookshelfHelper = BookshelfHelper("API_KEY")
Get bookshelves
val request = BookshelfGetRequest().apply {
    userID("116445025672089480971")
    maxResults(1)
    startIndex(0)
}

val bookshelf: Bookshelf = bookshelfHelper.get(request)
Get specific bookshelf
val request = BookshelfGetIDRequest().apply {
    userID("116445025672089480971")
    bookshelfID(1001)
}

val item: BookshelfItem = bookshelfHelper.getBookshelfWithID(request)
Get volumes in bookshelf
val request = BookshelfGetVolumesRequest().apply {
    userID("116445025672089480971")
    bookshelfID(1001)
    maxResults(5)
    startIndex(0)
    projection(ProjectionOption.LITE)
}

val volumes: Volume = bookshelfHelper.getVolumesInBookshelf(request)

Download

Groovy

allprojects {
  repositories {
      maven { url "https://jitpack.io" }
  }
}

dependencies {
   implementation 'com.github.MatthiasReumann:googlebooksapi:master-SNAPSHOT'
}

Kotlin DSL

allprojects {
  repositories {
    maven { url = uri("https://www.jitpack.io") }
  }
}

dependencies {
   implementation("com.github.MatthiasReumann:googlebooksapi:master-SNAPSHOT")
}