openlibrary

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 9 Imported by: 0

README

openlibrary-go

Go Reference

A Go client library for the OpenLibrary API. Provides fluent access to authors, works, editions, search, covers, and subjects.

Installation

go get github.com/raitucarp/openlibrary-go

Documentation

Full API reference: https://pkg.go.dev/github.com/raitucarp/openlibrary-go

Examples

All runnable examples are available at: https://pkg.go.dev/github.com/raitucarp/openlibrary-go#pkg-examples

License

MIT

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Key            string            `json:"key"`
	Name           string            `json:"name"`
	Type           string            `json:"type"`
	AlternateNames []string          `json:"alternate_names,omitempty"`
	Bio            *TextBlock        `json:"bio,omitempty"`
	BirthDate      *string           `json:"birth_date,omitempty"`
	DeathDate      *string           `json:"death_date,omitempty"`
	Date           *string           `json:"date,omitempty"`
	EntityType     *string           `json:"entity_type,omitempty"`
	FullerName     *string           `json:"fuller_name,omitempty"`
	PersonalName   *string           `json:"personal_name,omitempty"`
	Title          *string           `json:"title,omitempty"`
	Photos         []int64           `json:"photos,omitempty"`
	Links          []Link            `json:"links,omitempty"`
	RemoteIDs      *RemoteIDs        `json:"remote_ids,omitempty"`
	Revision       int64             `json:"revision"`
	LatestRevision *int64            `json:"latest_revision,omitempty"`
	Created        *InternalDateTime `json:"created,omitempty"`
	LastModified   InternalDateTime  `json:"last_modified"`
}

func (*Author) Photo added in v0.2.0

func (api *Author) Photo() (photoAPI *AuthorPhotoAPI)

func (*Author) Works added in v0.2.0

func (api *Author) Works() (worksAPI *AuthorWorksAPI)

type AuthorAPI added in v0.2.0

type AuthorAPI struct {
	// contains filtered or unexported fields
}

func (*AuthorAPI) Data added in v0.2.0

func (api *AuthorAPI) Data() (author *Author)

func (*AuthorAPI) Fetch added in v0.2.0

func (api *AuthorAPI) Fetch() (err error)

func (*AuthorAPI) Photo added in v0.2.0

func (api *AuthorAPI) Photo() (photoAPI *AuthorPhotoAPI)

type AuthorKey

type AuthorKey string

type AuthorPhotoAPI added in v0.2.0

type AuthorPhotoAPI struct {
	// contains filtered or unexported fields
}

func (*AuthorPhotoAPI) Get added in v0.2.0

func (api *AuthorPhotoAPI) Get() (imgBytes []byte, mimeType string, err error)

func (*AuthorPhotoAPI) ID added in v0.2.0

func (api *AuthorPhotoAPI) ID(id string) *AuthorPhotoAPI

func (*AuthorPhotoAPI) Large added in v0.2.0

func (api *AuthorPhotoAPI) Large() *AuthorPhotoAPI

func (*AuthorPhotoAPI) Medium added in v0.2.0

func (api *AuthorPhotoAPI) Medium() *AuthorPhotoAPI

func (*AuthorPhotoAPI) OLID added in v0.2.0

func (api *AuthorPhotoAPI) OLID(olid string) *AuthorPhotoAPI

func (*AuthorPhotoAPI) Small added in v0.2.0

func (api *AuthorPhotoAPI) Small() *AuthorPhotoAPI

type AuthorPictureKind added in v0.2.0

type AuthorPictureKind string
const (
	AuthorByID   AuthorPictureKind = "id"
	AuthorByOLID AuthorPictureKind = "olid"
)

type AuthorRole

type AuthorRole struct {
	Type   AuthorRoleType `json:"type"`
	Author AuthorWithKey  `json:"author"`
	Role   *string        `json:"role,omitempty"`
	As     *string        `json:"as,omitempty"`
}

type AuthorRoleType

type AuthorRoleType struct {
	Key string `json:"key"`
}

type AuthorSearch added in v0.2.0

type AuthorSearch struct {
	// contains filtered or unexported fields
}
Example

ExampleAuthorSearch demonstrates searching authors.

client := openlibrary.NewClient()

search, err := client.Authors().Query("Tolkien").Search()
if err != nil || len(search.Docs) == 0 {
	fmt.Println("no results")
	return
}

first := search.Docs[0]
fmt.Println(first.Name)
Output:

J.R.R. Tolkien

func (*AuthorSearch) Search added in v0.2.0

func (api *AuthorSearch) Search() (resp *AuthorSearchResponse, err error)

type AuthorSearchResponse added in v0.2.0

type AuthorSearchResponse struct {
	NumFound      int                  `json:"numFound,omitempty"`
	Start         int                  `json:"start,omitempty"`
	NumFoundExact bool                 `json:"numFoundExact,omitempty"`
	Docs          []AuthorSearchResult `json:"docs,omitempty"`
}

type AuthorSearchResult added in v0.2.0

type AuthorSearchResult struct {
	Key                   string   `json:"key,omitempty"`
	Name                  string   `json:"name,omitempty"`
	AlternateNames        []string `json:"alternate_names,omitempty"`
	BirthDate             string   `json:"birth_date,omitempty"`
	DeathDate             string   `json:"death_date,omitempty"`
	Date                  string   `json:"date,omitempty"`
	WorkCount             int      `json:"work_count,omitempty"`
	TopWork               string   `json:"top_work,omitempty"`
	TopSubjects           []string `json:"top_subjects,omitempty"`
	Type                  string   `json:"type,omitempty"`
	RatingsAverage        float64  `json:"ratings_average,omitempty"`
	RatingsSortable       float64  `json:"ratings_sortable,omitempty"`
	RatingsCount          int      `json:"ratings_count,omitempty"`
	RatingsCount1         int      `json:"ratings_count_1,omitempty"`
	RatingsCount2         int      `json:"ratings_count_2,omitempty"`
	RatingsCount3         int      `json:"ratings_count_3,omitempty"`
	RatingsCount4         int      `json:"ratings_count_4,omitempty"`
	RatingsCount5         int      `json:"ratings_count_5,omitempty"`
	WantToReadCount       int      `json:"want_to_read_count,omitempty"`
	AlreadyReadCount      int      `json:"already_read_count,omitempty"`
	CurrentlyReadingCount int      `json:"currently_reading_count,omitempty"`
	ReadinglogCount       int      `json:"readinglog_count,omitempty"`
	Version               int64    `json:"_version_,omitempty"`
}

func (*AuthorSearchResult) Photo added in v0.2.0

func (api *AuthorSearchResult) Photo() (photoAPI *AuthorPhotoAPI)

func (*AuthorSearchResult) Works added in v0.2.0

func (api *AuthorSearchResult) Works() (worksAPI *AuthorWorksAPI)

type AuthorSize added in v0.2.0

type AuthorSize string
const (
	AuthorPictureSmall  AuthorSize = "S"
	AuthorPictureMedium AuthorSize = "M"
	AuthorPictureLarge  AuthorSize = "L"
)

type AuthorType added in v0.2.0

type AuthorType struct {
	Key string `json:"key"`
}

type AuthorWithKey added in v0.2.0

type AuthorWithKey struct {
	Key string `json:"key"`
}

type AuthorWorksAPI added in v0.2.0

type AuthorWorksAPI struct {
	// contains filtered or unexported fields
}

func (*AuthorWorksAPI) Fetch added in v0.2.0

func (api *AuthorWorksAPI) Fetch() (resp *AuthorWorksResponse, err error)

func (*AuthorWorksAPI) Limit added in v0.2.0

func (api *AuthorWorksAPI) Limit(limit int) *AuthorWorksAPI

func (*AuthorWorksAPI) Offset added in v0.2.0

func (api *AuthorWorksAPI) Offset(offset int) *AuthorWorksAPI

type AuthorWorksResponse added in v0.2.0

type AuthorWorksResponse struct {
	Links struct {
		Self string `json:"self,omitempty"`
		Work string `json:"work,omitempty"`
		Next string `json:"next,omitempty"`
	} `json:"links"`
	Size    int     `json:"size,omitempty"`
	Entries []Works `json:"entries"`
}

type AuthorsAPI added in v0.2.0

type AuthorsAPI struct {
	// contains filtered or unexported fields
}

func (*AuthorsAPI) ByIdentifier added in v0.2.0

func (api *AuthorsAPI) ByIdentifier(identifier string) *AuthorAPI

func (*AuthorsAPI) Photo added in v0.2.0

func (api *AuthorsAPI) Photo() *AuthorPhotoAPI

func (*AuthorsAPI) Query added in v0.2.0

func (api *AuthorsAPI) Query(author string) *AuthorSearch

type Bookshelve

type Bookshelve struct {
	Counts struct {
		WantToRead       int `json:"want_to_read,omitempty"`
		CurrentlyReading int `json:"currently_reading,omitempty"`
		AlreadyRead      int `json:"already_read,omitempty"`
	} `json:"counts"`
}

type Client added in v0.1.1

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client
Example

ExampleNewClient demonstrates creating a new OpenLibrary client.

client := openlibrary.NewClient()
_ = client
fmt.Println("client ready")
Output:

client ready

func (*Client) Authors added in v0.2.0

func (c *Client) Authors() *AuthorsAPI

func (*Client) Cover added in v0.1.1

func (c *Client) Cover() *CoverAPI

func (*Client) Edition added in v0.1.1

func (c *Client) Edition(key string) *EditionAPI

func (*Client) ISBN added in v0.1.1

func (c *Client) ISBN(isbn string) *ISBNAPI

func (*Client) Search added in v0.1.1

func (c *Client) Search() *SearchAPI

func (*Client) SetUserAgent added in v0.1.1

func (c *Client) SetUserAgent(useragent string)

func (*Client) Subjects added in v0.2.0

func (c *Client) Subjects(subject string) *SubjectsAPI

func (*Client) Works added in v0.1.1

func (c *Client) Works(key string) *WorksAPI

type CoverAPI added in v0.1.1

type CoverAPI struct {
	// contains filtered or unexported fields
}

func (*CoverAPI) Get added in v0.1.1

func (api *CoverAPI) Get() (imgBytes []byte, mimeType string, err error)

func (*CoverAPI) ID added in v0.1.1

func (api *CoverAPI) ID(id string) *CoverAPI

func (*CoverAPI) ISBN added in v0.1.1

func (api *CoverAPI) ISBN(isbn string) *CoverAPI

func (*CoverAPI) LCCN added in v0.1.1

func (api *CoverAPI) LCCN(lccn string) *CoverAPI

func (*CoverAPI) Large added in v0.1.1

func (api *CoverAPI) Large() *CoverAPI

func (*CoverAPI) Medium added in v0.1.1

func (api *CoverAPI) Medium() *CoverAPI

func (*CoverAPI) OCLC added in v0.1.1

func (api *CoverAPI) OCLC(oclc string) *CoverAPI

func (*CoverAPI) OLID added in v0.1.1

func (api *CoverAPI) OLID(olid string) *CoverAPI

func (*CoverAPI) Small added in v0.1.1

func (api *CoverAPI) Small() *CoverAPI

type CoverKind

type CoverKind string
const (
	ISBNCover CoverKind = "isbn"
	OCLCCover CoverKind = "oclc"
	LCCNCover CoverKind = "lccn"
	OLIDCover CoverKind = "olid"
	IDCover   CoverKind = "id"
)

type CoverSize

type CoverSize string
const (
	CoverSmall  CoverSize = "S"
	CoverMedium CoverSize = "M"
	CoverLarge  CoverSize = "L"
)

type EbookAccess

type EbookAccess string
const (
	NoEbookAccess       EbookAccess = "no_ebook"
	UnclassifiedAccess  EbookAccess = "unclassified"
	PrintDisabledAccess EbookAccess = "printdisabled"
	BorrowableAccess    EbookAccess = "borrowable"
	PublicAccessAccess  EbookAccess = "public"
)

func (EbookAccess) String

func (a EbookAccess) String() string

type Edition

type Edition struct {
	Key                string            `json:"key"`
	Title              string            `json:"title"`
	Subtitle           *string           `json:"subtitle,omitempty"`
	Type               EditionType       `json:"type"`
	Authors            []AuthorWithKey   `json:"authors,omitempty"`
	Works              []WorkReference   `json:"works"`
	Identifiers        map[string]any    `json:"identifiers,omitempty"`
	ISBN10             []string          `json:"isbn_10,omitempty"`
	ISBN13             []string          `json:"isbn_13,omitempty"`
	LCCN               []string          `json:"lccn,omitempty"`
	OcaId              string            `json:"ocaid,omitempty"`
	OCLCNumbers        []string          `json:"oclc_numbers,omitempty"`
	LocalID            []string          `json:"local_id,omitempty"`
	Covers             []int64           `json:"covers,omitempty"`
	Links              []Link            `json:"links,omitempty"`
	Languages          []Language        `json:"languages,omitempty"`
	TranslatedFrom     []Language        `json:"translated_from,omitempty"`
	TranslationOf      string            `json:"translation_of,omitempty"`
	ByStatement        string            `json:"by_statement,omitempty"`
	Weight             string            `json:"weight,omitempty"`
	EditionName        string            `json:"edition_name,omitempty"`
	NumberOfPages      int64             `json:"number_of_pages,omitempty"`
	Pagination         string            `json:"pagination,omitempty"`
	PhysicalDimensions string            `json:"physical_dimensions,omitempty"`
	PhysicalFormat     string            `json:"physical_format,omitempty"`
	CopyrightDate      string            `json:"copyright_date,omitempty"`
	PublishCountry     string            `json:"publish_country,omitempty"` // Pattern: "^[a-z]{2,3}$"
	PublishDate        string            `json:"publish_date,omitempty"`
	PublishPlaces      []string          `json:"publish_places,omitempty"`
	Publishers         []string          `json:"publishers,omitempty"`
	Contributions      []string          `json:"contributions,omitempty"`
	DeweyDecimalClass  []string          `json:"dewey_decimal_class,omitempty"`
	Genres             []string          `json:"genres,omitempty"`
	LcClassifications  []string          `json:"lc_classifications,omitempty"`
	OtherTitles        []string          `json:"other_titles,omitempty"`
	Series             []string          `json:"series,omitempty"`
	SourceRecords      []string          `json:"source_records,omitempty"`
	Subjects           []string          `json:"subjects,omitempty"`
	WorkTitles         []string          `json:"work_titles,omitempty"`
	TableOfContents    []any             `json:"table_of_contents,omitempty"`
	Description        *TextBlock        `json:"description,omitempty"`
	FirstSentence      *TextBlock        `json:"first_sentence,omitempty"`
	Notes              *TextBlock        `json:"notes,omitempty"`
	Revision           int64             `json:"revision"`
	LatestRevision     int64             `json:"latest_revision,omitempty"`
	Created            *InternalDateTime `json:"created,omitempty"`
	LastModified       *InternalDateTime `json:"last_modified,omitempty"`
}

type EditionAPI added in v0.1.1

type EditionAPI struct {
	// contains filtered or unexported fields
}

func (*EditionAPI) Get added in v0.1.1

func (api *EditionAPI) Get() (resp *Edition, err error)

type EditionKey

type EditionKey string

type EditionType

type EditionType struct {
	Key string `json:"key"`
}

type EditionsResponse

type EditionsResponse struct {
	Links struct {
		Self string `json:"self,omitempty"`
		Work string `json:"work,omitempty"`
		Next string `json:"next,omitempty"`
	} `json:"links"`
	Size    int       `json:"size,omitempty"`
	Entries []Edition `json:"entries"`
}

type ISBNAPI added in v0.1.1

type ISBNAPI struct {
	// contains filtered or unexported fields
}

func (*ISBNAPI) Get added in v0.1.1

func (api *ISBNAPI) Get() (resp *Edition, err error)

type InternalDateTime

type InternalDateTime struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type Language

type Language struct {
	Key string `json:"key"`
}

type LanguageCode

type LanguageCode string

type LcClassification

type LcClassification string
type Link struct {
	URL   string    `json:"url"`
	Title string    `json:"title"`
	Type  *LinkType `json:"type,omitempty"`
}

type LinkType

type LinkType struct {
	Key string `json:"key"`
}

type PublishCountry

type PublishCountry string

type Rating

type Rating struct {
	Summary struct {
		Average  int `json:"average,omitempty"`
		Count    int `json:"count,omitempty"`
		Sortable int `json:"sortable,omitempty"`
	} `json:"summary"`

	Counts struct {
		One   int `json:"1,omitempty"`
		Two   int `json:"2,omitempty"`
		Three int `json:"3,omitempty"`
		Four  int `json:"4,omitempty"`
		Five  int `json:"5,omitempty"`
	} `json:"counts"`
}

type RemoteIDs added in v0.2.0

type RemoteIDs struct {
	Wikidata *string `json:"wikidata,omitempty"`
	Viaf     *string `json:"viaf,omitempty"`
}

type SearchAPI added in v0.1.1

type SearchAPI struct {
	// contains filtered or unexported fields
}

func (*SearchAPI) Author added in v0.1.1

func (api *SearchAPI) Author(author string) *SearchAPI

func (*SearchAPI) Authors added in v0.1.1

func (api *SearchAPI) Authors(author string) *SearchAPI

func (*SearchAPI) Do added in v0.1.1

func (api *SearchAPI) Do() (resp *SearchResponse, err error)

func (*SearchAPI) Fields added in v0.1.1

func (api *SearchAPI) Fields(fields ...SearchField) *SearchAPI

func (*SearchAPI) Query added in v0.1.1

func (api *SearchAPI) Query(q string) *SearchAPI

type SearchField

type SearchField string
const (
	KeyField                   SearchField = "key"
	RedirectsField             SearchField = "redirects"
	TitleField                 SearchField = "title"
	SubtitleField              SearchField = "subtitle"
	AlternativeTitleField      SearchField = "alternative_title"
	AlternativeSubtitleField   SearchField = "alternative_subtitle"
	CoverIField                SearchField = "cover_i"
	EbookAccessField           SearchField = "ebook_access"
	EditionCountField          SearchField = "edition_count"
	EditionKeyField            SearchField = "edition_key"
	FormatField                SearchField = "format"
	ByStatementField           SearchField = "by_statement"
	PublishDateField           SearchField = "publish_date"
	LccnField                  SearchField = "lccn"
	IAField                    SearchField = "ia"
	OCLCField                  SearchField = "oclc"
	ISBNField                  SearchField = "isbn"
	ContributorField           SearchField = "contributor"
	PublishPlaceField          SearchField = "publish_place"
	PublisherField             SearchField = "publisher"
	FirstSentenceField         SearchField = "first_sentence"
	AuthorKeyField             SearchField = "author_key"
	AuthorNameField            SearchField = "author_name"
	AuthorAlternativeNameField SearchField = "author_alternative_name"
	SubjectField               SearchField = "subject"
	PersonField                SearchField = "person"
	PlaceField                 SearchField = "place"
	TimeField                  SearchField = "time"
	HasFulltextField           SearchField = "has_fulltext"
	TitleSuggestField          SearchField = "title_suggest"
	PublishYearField           SearchField = "publish_year"
	LanguageField              SearchField = "language"
	NumberOfPagesMedianField   SearchField = "number_of_pages_median"
	IACountField               SearchField = "ia_count"
	PublisherFacetField        SearchField = "publisher_facet"
	AuthorFacetField           SearchField = "author_facet"
	FirstPublishYearField      SearchField = "first_publish_year"
	RatingsCountField          SearchField = "ratings_count"
	ReadinglogCountField       SearchField = "readinglog_count"
	WantToReadCountField       SearchField = "want_to_read_count"
	CurrentlyReadingCountField SearchField = "currently_reading_count"
	AlreadyReadCountField      SearchField = "already_read_count"
	SubjectKeyField            SearchField = "subject_key"
	PersonKeyField             SearchField = "person_key"
	PlaceKeyField              SearchField = "place_key"
	TimeKeyField               SearchField = "time_key"
	LLCField                   SearchField = "lcc"
	DDCField                   SearchField = "ddc"
	LCCSortField               SearchField = "lcc_sort"
	DDCSortField               SearchField = "ddc_sort"
)

type SearchResponse

type SearchResponse struct {
	NumFound      int            `json:"numFound,omitempty"`
	Start         int            `json:"start,omitempty"`
	NumFoundExact bool           `json:"numFoundExact,omitempty"`
	NumFound_     int            `json:"num_found,omitempty"`
	Query         string         `json:"q,omitempty"`
	DocUrl        string         `json:"documentation_url,omitempty"`
	Offset        int            `json:"offset,omitempty"`
	Docs          []SearchResult `json:"docs,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchResponse) ToClient

func (sr *SearchResponse) ToClient() *Client

type SearchResult

type SearchResult struct {
	Key                   string      `json:"key"`
	Redirects             []string    `json:"redirects,omitempty"`
	Title                 string      `json:"title"`
	Subtitle              string      `json:"subtitle,omitempty"`
	AlternativeTitle      []string    `json:"alternative_title,omitempty"`
	AlternativeSubtitle   []string    `json:"alternative_subtitle,omitempty"`
	CoverI                int         `json:"cover_i,omitempty"`
	EbookAccess           EbookAccess `json:"ebook_access,omitempty"`
	EditionCount          int         `json:"edition_count,omitempty"`
	EditionKey            []string    `json:"edition_key,omitempty"`
	Format                []string    `json:"format,omitempty"`
	ByStatement           []string    `json:"by_statement,omitempty"`
	PublishDate           []string    `json:"publish_date,omitempty"`
	LCCN                  []string    `json:"lccn,omitempty"`
	IA                    []string    `json:"ia,omitempty"`
	Oclc                  []string    `json:"oclc,omitempty"`
	ISBN                  []string    `json:"isbn,omitempty"`
	Contributor           []string    `json:"contributor,omitempty"`
	PublishPlace          []string    `json:"publish_place,omitempty"`
	Publisher             []string    `json:"publisher,omitempty"`
	FirstSentence         []string    `json:"first_sentence,omitempty"`
	AuthorKey             []string    `json:"author_key,omitempty"`
	AuthorName            []string    `json:"author_name,omitempty"`
	AuthorAlternativeName []string    `json:"author_alternative_name,omitempty"`
	Subject               []string    `json:"subject,omitempty"`
	Person                []string    `json:"person,omitempty"`
	Place                 []string    `json:"place,omitempty"`
	Time                  []string    `json:"time"`
	HasFulltext           bool        `json:"has_fulltext,omitempty"`
	TitleSuggest          string      `json:"title_suggest,omitempty"`
	PublishYear           []int       `json:"publish_year,omitempty"`
	Language              []string    `json:"language,omitempty"`
	NumberOfPagesMedian   int         `json:"number_of_pages_median,omitempty"`
	IaCount               int         `json:"ia_count,omitempty"`
	PublisherFacet        []string    `json:"publisher_facet,omitempty"`
	AuthorFacet           []string    `json:"author_facet,omitempty"`
	FirstPublishYear      int         `json:"first_publish_year,omitempty"`
	RatingsCount          int         `json:"ratings_count,omitempty"`
	ReadinglogCount       int         `json:"readinglog_count,omitempty"`
	WantToReadCount       int         `json:"want_to_read_count,omitempty"`
	CurrentlyReadingCount int         `json:"currently_reading_count,omitempty"`
	AlreadyReadCount      int         `json:"already_read_count,omitempty"`
	SubjectKey            []string    `json:"subject_key,omitempty"`
	PersonKey             []string    `json:"person_key,omitempty"`
	PlaceKey              []string    `json:"place_key,omitempty"`
	TimeKey               []string    `json:"time_key,omitempty"`
	LCC                   []string    `json:"lcc,omitempty"`
	DDC                   []string    `json:"ddc,omitempty"`
	LCCSort               string      `json:"lcc_sort,omitempty"`
	DDCSort               string      `json:"ddc_sort,omitempty"`
}

type SubjectsAPI added in v0.2.0

type SubjectsAPI struct {
	// contains filtered or unexported fields
}

func (*SubjectsAPI) Get added in v0.2.0

func (api *SubjectsAPI) Get() (resp *SubjectsResponse, err error)

func (*SubjectsAPI) Limit added in v0.2.0

func (api *SubjectsAPI) Limit(limit int) *SubjectsAPI

func (*SubjectsAPI) Offset added in v0.2.0

func (api *SubjectsAPI) Offset(offset int) *SubjectsAPI

func (*SubjectsAPI) PublishedIn added in v0.2.0

func (api *SubjectsAPI) PublishedIn(from int, to int) *SubjectsAPI

func (*SubjectsAPI) WithDetails added in v0.2.0

func (api *SubjectsAPI) WithDetails() *SubjectsAPI

func (*SubjectsAPI) WithEbooks added in v0.2.0

func (api *SubjectsAPI) WithEbooks() *SubjectsAPI

type SubjectsResponse added in v0.2.0

type SubjectsResponse struct {
	Key         string `json:"key,omitempty"`
	Name        string `json:"name,omitempty"`
	SubjectType string `json:"subject_type,omitempty"`
	SolrQuery   string `json:"solr_query,omitempty"`
	WorkCount   int    `json:"work_count,omitempty"`
	Works       []struct {
		Key               string   `json:"key,omitempty"`
		Title             string   `json:"title,omitempty"`
		EditionCount      int      `json:"edition_count,omitempty"`
		CoverID           int      `json:"cover_id,omitempty"`
		CoverEditionKey   string   `json:"cover_edition_key,omitempty"`
		Subject           []string `json:"subject,omitempty"`
		IaCollection      []string `json:"ia_collection,omitempty"`
		Printdisabled     bool     `json:"printdisabled,omitempty"`
		LendingEdition    string   `json:"lending_edition,omitempty"`
		LendingIdentifier string   `json:"lending_identifier,omitempty"`
		Authors           []struct {
			Key  string `json:"key,omitempty"`
			Name string `json:"name,omitempty"`
		} `json:"authors,omitempty"`
		FirstPublishYear int    `json:"first_publish_year,omitempty"`
		Ia               string `json:"ia,omitempty"`
		PublicScan       bool   `json:"public_scan,omitempty"`
		HasFulltext      bool   `json:"has_fulltext,omitempty"`
		Availability     *struct {
			Status              string `json:"status,omitempty"`
			AvailableToBrowse   bool   `json:"available_to_browse,omitempty"`
			AvailableToBorrow   bool   `json:"available_to_borrow,omitempty"`
			AvailableToWaitlist bool   `json:"available_to_waitlist,omitempty"`
			IsPrintdisabled     bool   `json:"is_printdisabled,omitempty"`
			IsReadable          bool   `json:"is_readable,omitempty"`
			IsLendable          bool   `json:"is_lendable,omitempty"`
			IsPreviewable       bool   `json:"is_previewable,omitempty"`
			Identifier          string `json:"identifier,omitempty"`
			Isbn                any    `json:"isbn,omitempty"`
			Oclc                any    `json:"oclc,omitempty"`
			OpenlibraryWork     string `json:"openlibrary_work,omitempty"`
			OpenlibraryEdition  string `json:"openlibrary_edition,omitempty"`
			LastLoanDate        any    `json:"last_loan_date,omitempty"`
			NumWaitlist         any    `json:"num_waitlist,omitempty"`
			LastWaitlistDate    any    `json:"last_waitlist_date,omitempty"`
			IsRestricted        bool   `json:"is_restricted,omitempty"`
			IsBrowseable        bool   `json:"is_browseable,omitempty"`
			Src                 string `json:"__src__,omitempty"`
		} `json:"availability,omitempty"`
	} `json:"works,omitempty"`
	EbookCount int `json:"ebook_count,omitempty"`
	Subjects   []struct {
		Key   string `json:"key,omitempty"`
		Name  string `json:"name,omitempty"`
		Count int    `json:"count,omitempty"`
	} `json:"subjects,omitempty"`
	Places []struct {
		Key   string `json:"key,omitempty"`
		Name  string `json:"name,omitempty"`
		Count int    `json:"count,omitempty"`
	} `json:"places,omitempty"`
	People []struct {
		Key   string `json:"key,omitempty"`
		Name  string `json:"name,omitempty"`
		Count int    `json:"count,omitempty"`
	} `json:"people,omitempty"`
	Times []struct {
		Key   string `json:"key,omitempty"`
		Name  string `json:"name,omitempty"`
		Count int    `json:"count,omitempty"`
	} `json:"times,omitempty"`
	Authors []struct {
		Name  string `json:"name,omitempty"`
		Key   string `json:"key,omitempty"`
		Count int    `json:"count,omitempty"`
	} `json:"authors,omitempty"`
	Publishers []struct {
		Name  string `json:"name,omitempty"`
		Count int    `json:"count,omitempty"`
		Key   string `json:"key,omitempty"`
	} `json:"publishers,omitempty"`
	Languages []struct {
		Name  string `json:"name,omitempty"`
		Count int    `json:"count,omitempty"`
	} `json:"languages,omitempty"`
	PublishingHistory [][]int `json:"publishing_history,omitempty"`
}

type TextBlock

type TextBlock struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Raw   string `json:"-"`
}

func (*TextBlock) UnmarshalJSON

func (tb *TextBlock) UnmarshalJSON(data []byte) error

type WorkKey

type WorkKey string

type WorkReference

type WorkReference struct {
	Key string `json:"key"`
}

type WorkType

type WorkType struct {
	Key string `json:"key"`
}

type Works added in v0.2.0

type Works struct {
	Key               string            `json:"key"`
	Title             string            `json:"title"`
	Subtitle          string            `json:"subtitle,omitempty"`
	Type              WorkType          `json:"type"`
	Authors           []AuthorRole      `json:"authors,omitempty"`
	Covers            []int64           `json:"covers,omitempty"`
	Links             []Link            `json:"links,omitempty"`
	ID                *int64            `json:"id,omitempty"`
	LCClassifications []string          `json:"lc_classifications,omitempty"`
	Subjects          []string          `json:"subjects,omitempty"`
	FirstPublishDate  string            `json:"first_publish_date,omitempty"`
	Description       *TextBlock        `json:"description,omitempty"`
	Notes             string            `json:"notes,omitempty"`
	Revision          int64             `json:"revision"`
	LatestRevision    int64             `json:"latest_revision,omitempty"`
	Created           *InternalDateTime `json:"created,omitempty"`
	LastModified      *InternalDateTime `json:"last_modified"`
}

type WorksAPI added in v0.1.1

type WorksAPI struct {
	// contains filtered or unexported fields
}

func (*WorksAPI) Bookshelves added in v0.1.1

func (api *WorksAPI) Bookshelves() (resp *Bookshelve, err error)

func (*WorksAPI) Editions added in v0.1.1

func (api *WorksAPI) Editions() (resp *EditionsResponse, err error)

func (*WorksAPI) Get added in v0.1.1

func (api *WorksAPI) Get() (resp *Works, err error)

func (*WorksAPI) Ratings added in v0.1.1

func (api *WorksAPI) Ratings() (resp *Rating, err error)

Jump to

Keyboard shortcuts

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