Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.67 KB

BookAPI.md

File metadata and controls

59 lines (44 loc) · 1.67 KB

Book/EditionAPI

Here you can find all the information on how to get Books and what methods the Book struct has.

EditionAPI Examples

In these examples you will find the most useful methods/function, for more low level on Book structs you can look at the documentation.

    book, err := gol.GetEdition("OL4554174M") // Get the edition using the openlibrary ID
    // Output:
    // Book, error
    
    book, err := gol.GetEditionISBN("978-3-16-148410-0") // Get the edition from the ISBN key
    // Output:
    // Book, error
    
    // To load "all" information from the JSON data in the struct
    book.Load()

    // To get the title of the book
    title, err := book.Title()

    // To get the number of pages
    pages, err := book.NumberOfPages()

    // to get the Publishers of the book
    pubs, err := book.Publishers()

    // to get the subjects of the book
    subjects, err := book.Subjects()
    
    // to get the isbn10 identifier
    isbn, err := book.Isbn10()
    
    // to get goodreads id
    gr, err := book.GoodReads()

    // Returns all the information of the book's authors
    // Get the keys/ids of the book's author
    keyauthors, err := book.KeyAuthors()

    // Get the Authors of the book
    authors, err := book.Authors() // Alternatively you can use Authors(book)
    // Output:
    // []Author, error
    
    // To get the cover keys/ids of the book
    keys, err := book.KeyCovers()
    // Output:
    // []String, error
    
    // To get the first (index 0) cover of the book
    key := book.FirstCoverKey()
    // Output:
    // string

    cover := book.Cover("S") // Returns the URL of the book's cover (size Small)
    // Output:
    // url