UNPKG

isbndb-client

Version:
33 lines (32 loc) 1.08 kB
import { AxiosInstance, AxiosError } from "axios"; /** * Available subscription plans on ISBNdb. * - BASIC: 1 req/sec * - PREMIUM: 3 req/sec — uses https://api.premium.isbndb.com * - PRO: 5 req/sec — uses https://api.pro.isbndb.com */ export type IsbndbPlan = "BASIC" | "PREMIUM" | "PRO"; /** * Creates an Axios instance preconfigured for the ISBNdb API. * * @param apiKey Your personal API key from isbndb.com * @param plan The plan level to determine the correct base URL. Defaults to 'BASIC' * @returns AxiosInstance preconfigured with baseURL and headers */ export declare function createIsbndbClient(apiKey: string, plan?: IsbndbPlan): AxiosInstance; /** * A standardized error structure for all failed API calls. */ export interface IsbndbError { status: number; statusText?: string; message: string; url?: string; } /** * Formats an AxiosError into a more readable IsbndbError. * * @param error AxiosError from the request * @returns IsbndbError object */ export declare function formatIsbndbError(error: AxiosError): IsbndbError;