gobookprices

package
v0.0.0-...-65cb0cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HostUrl = "https://www.goodreads.com/"

Variables

View Source
var EbookFormats = []string{"ebook", "Kindle Edition"} // EbooksFormats contains all formats that represent a form a ebook on goodreads.

Functions

This section is empty.

Types

type Book

type Book struct {
	Title       string    // Title of book.
	Author      string    // Author of book.
	Isbn        string    // Isbn of this book. Note: remove as only edition isbn is relevant?
	WorkUrl     string    // This is the url to the work on goodreads.
	EditionsUrl string    // This is the url to all editions of the work.
	Editions    []Edition // This contains all editions that belong to the work.
}

Book represents a book on a goodread list. It can be a work or an edition.

func GetBooks

func GetBooks(hostUrl, goodreadsList, shelf string) ([]Book, error)

GetBooks takes a list and a specific shelf. It returns the books from that shelf and an error. Example url: /review/list/68156753

type Edition

type Edition struct {
	Isbn     string
	Format   string
	Language string
}

Edition represents an edition of a work.

func GetEditions

func GetEditions(hostUrl, editionsUrl string, formats []string, languages []string) ([]Edition, error)

GetEditions takes an url to editions on goodreads, the required formats and languages. It returns all editions that belong to that work, adhere to the parameters and have a ISBN. Example expected url: "/work/editions/94024291"

type Library

type Library struct {
	ListUrl   string
	Shelf     string
	Formats   []string
	Languages []string
	Books     []Book
	// contains filtered or unexported fields
}

func NewLibrary

func NewLibrary(listUrl, shelf string, formats []string, languages []string) Library

NewLibrary takes all parameters for the url (host, list and shelf), the required book formats and languages. It returns an empty library with all parameters.

func (*Library) Get

func (l *Library) Get() error

Get connects to the host with all parameters that are specified in the type. It retrieves all books, get the editions not yet present, updates the library and returns an error.

func (*Library) GetAll

func (l *Library) GetAll() error

GetAll connects to the host with all parameters that are specified in the type. It retrieves all books, retrieves the corresponding editions and updates the library. It returns an error.

func (*Library) UpdateConfig

func (l *Library) UpdateConfig(listUrl, shelf string, formats, languages []string)

UpdateConfig takes the library parameters and updates them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL