UNPKG

isbndb-client

Version:
56 lines (55 loc) 2.35 kB
import { AxiosInstance, AxiosResponse } from "axios"; import { BookResponse, BookSearchResponse, AuthorResponse, AuthorQueryResults, Publisher, PublisherSearchResponse, Subject, SubjectSearchResponse, SearchIndexResponse, StatsResponse, BookSearchOptions, AuthorSearchOptions, AuthorDetailOptions, PublisherSearchOptions, PublisherDetailOptions, SubjectSearchOptions, IndexSearchOptions } from "./types"; /** * A typed wrapper for the ISBNdb v2 API. * * Instantiate using: * ```ts * const client = createIsbndbClient('API_KEY', 'PRO'); * const isbndb = new IsbndbService(client); * ``` */ export declare class IsbndbService { private client; constructor(client: AxiosInstance); /** * Fetch book details by ISBN-10 or ISBN-13. */ getBook(isbn: string, withPrices?: boolean): Promise<AxiosResponse<BookResponse>>; /** * Search for books by keyword and optional filters. */ searchBooks(query: string, options?: BookSearchOptions): Promise<AxiosResponse<BookSearchResponse>>; /** * Fetch author details and book list by author name. */ getAuthor(name: string, options?: AuthorDetailOptions): Promise<AxiosResponse<AuthorResponse>>; /** * Search authors by name. */ searchAuthors(query: string, options?: AuthorSearchOptions): Promise<AxiosResponse<AuthorQueryResults>>; /** * Fetch publisher details and book list by publisher name. */ getPublisher(name: string, options?: PublisherDetailOptions): Promise<AxiosResponse<Publisher>>; /** * Search publishers by query. */ searchPublishers(query: string, options?: PublisherSearchOptions): Promise<AxiosResponse<PublisherSearchResponse>>; /** * Fetch a subject and its parent. */ getSubject(name: string): Promise<AxiosResponse<Subject>>; /** * Search subjects by query. */ searchSubjects(query: string, options?: SubjectSearchOptions): Promise<AxiosResponse<SubjectSearchResponse>>; /** * Perform a general search across one of the supported indexes. */ searchIndex(index: "subjects" | "publishers" | "authors" | "books", options?: IndexSearchOptions): Promise<AxiosResponse<SearchIndexResponse>>; /** * Retrieve general stats about the ISBNdb database. */ getStats(): Promise<AxiosResponse<StatsResponse>>; }