Aller au contenu

omnischolar/openlibrary Référence de l’API

Étage
Fournisseur · Omnischolar
Version
1.x
Suite de conformité
non branchée
Vérifié en réel
Son README ne le dit pas
Licence
MIT
composer require omnischolar/openlibrary:1.x-dev

Lue dans les fichiers PHP du paquet au commit b9a8af5424b3 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnischolar\OpenLibrary

  • OpenLibrarySource class

    Open Library (openlibrary.org, no key): books. An author's books - by their Open Library id or their name, every spelling of it - one record per edition, each with its ISBNs, publisher, date and cover: the Merger groups the editions of a book. A book by ISBN or Open Library id; a search; an author's page (bio, links, ORCID when given).

    7 methods · 2 constants

  • OpenLibrarySourceFactory class

    Open Library: books, their editions and covers - no key.

    3 options

Omnischolar\OpenLibrary

OpenLibrarySource class

final class OpenLibrarySource extends HttpSource OpenLibrarySource.php:30

Open Library (openlibrary.org, no key): books. An author's books - by their Open Library id or their name, every spelling of it - one record per edition, each with its ISBNs, publisher, date and cover: the Merger groups the editions of a book. A book by ISBN or Open Library id; a search; an author's page (bio, links, ORCID when given).

Open Library asks callers to name themselves: the User-Agent carries the mailto. Its works list its editions in a second call (editions.json): a page of 25 works may cost as many calls - hence the throttle.

const BASE_URI = 'https://openlibrary.org/'
const COVERS = 'https://covers.openlibrary.org/b/id/%d-L.jpg'

OpenLibrarySource::__construct()

public function __construct(HttpClientInterface $http, readonly bool $editions = true, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)

OpenLibrarySource::getName()

public function getName(): string

OpenLibrarySource::capabilities()

public function capabilities(): array

OpenLibrarySource::author()

public function author(Identifier|string $author): ?Author

An author by their Open Library id (OL7092953A), or the first one a name finds.

OpenLibrarySource::works()

public function works(Identifier|string $author, ?Query $query = null): Page

An author's books, one record per edition: by their Open Library id (only the books filed under it) or by their name (every author record of that name: "Monica Neagoy", "MONICA NEAGOY", "Monica M. Neagoy"...). The cursor is a page number.

OpenLibrarySource::work()

public function work(Identifier|string $id): ?Work

A book by its ISBN (that edition), its edition id (OL...M) or its work id (OL...W).

public function search(Query $query): Page

OpenLibrarySourceFactory class

final class OpenLibrarySourceFactory extends SourceFactory OpenLibrarySourceFactory.php:19

Open Library: books, their editions and covers - no key.

options: mailto: 'support@glitchr.io' # in the User-Agent, as Open Library asks of its callers editions: true # one record per edition (the Merger groups them); false: one per work throttle: 0.4 # seconds between two calls (Open Library allows about 3 a second to a named caller) base_uri: 'https://openlibrary.org/'

Options

OptionDefault
editionstrue
throttle0.4
base_uriOpenLibrarySource::BASE_URI