Documentation
¶
Overview ¶
Package openlibrary is a golang implementation of the Open Library API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCoverURL ¶
GetCoverURL constructs a cover image URL given an ISBN and size size can be "S" (small), "M" (medium), or "L" (large)
func GetCoverURLByID ¶ added in v0.2.0
GetCoverURLByID constructs a cover image URL given a cover ID and size The Works API returns cover IDs (ints), not URLs size can be "S" (small), "M" (medium), or "L" (large)
Types ¶
type BookData ¶
type BookData struct {
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Authors []Author `json:"authors"`
Publishers []Publisher `json:"publishers"`
PublishDate string `json:"publish_date"`
NumberOfPages int `json:"number_of_pages"`
Cover Cover `json:"cover"`
Identifiers Identifier `json:"identifiers"`
Subjects []Subject `json:"subjects"`
Notes string `json:"notes"`
URL string `json:"url"`
Key string `json:"key"`
}
BookData is the detailed book data from the Books API
type BookResult ¶
type BookResult struct {
Title string
Subtitle string
Authors string // Comma-separated author names
Publishers string // Comma-separated publishers
PublishDate string
Pages int
ISBN10 string
ISBN13 string
CoverSmall string
CoverMedium string
CoverLarge string
Subjects string // Comma-separated subjects
Description string
OLID string // Open Library ID
WorkKey string // Open Library work key (e.g., "/works/OL81634W")
Error string
}
BookResult is the simplified result struct for our application
type BooksAPIResponse ¶
BooksAPIResponse is the wrapper response from the Books API
type Cover ¶
type Cover struct {
Small string `json:"small"`
Medium string `json:"medium"`
Large string `json:"large"`
}
Cover represents cover image URLs
type Identifier ¶
Identifier represents ISBN identifiers
type OpenLibraryApi ¶
type OpenLibraryApi struct {
// contains filtered or unexported fields
}
func Init ¶
func Init(name, version, email string) *OpenLibraryApi
func (*OpenLibraryApi) BookByISBN ¶
func (api *OpenLibraryApi) BookByISBN(isbn string) (*BookResult, error)
BookByISBN returns detailed book data given an ISBN (10 or 13 digit)
func (*OpenLibraryApi) SearchBooks ¶
func (api *OpenLibraryApi) SearchBooks(query string, limit int) (*SearchResponse, error)
SearchBooks searches for books by query string
func (*OpenLibraryApi) WorkByKey ¶ added in v0.2.0
func (api *OpenLibraryApi) WorkByKey(key string) (*WorkResult, error)
WorkByKey fetches work-level data from the Open Library Works API
type Publisher ¶
type Publisher struct {
Name string `json:"name"`
}
Publisher represents a publisher
type SearchDoc ¶
type SearchDoc struct {
Title string `json:"title"`
AuthorName []string `json:"author_name"`
FirstPublishYear int `json:"first_publish_year"`
ISBN []string `json:"isbn"`
CoverI int `json:"cover_i"`
EditionCount int `json:"edition_count"`
Key string `json:"key"`
}
SearchDoc represents a single search result document
type SearchResponse ¶
SearchResponse is the response from the search API