UNPKG

mindee

Version:

Mindee Client Library for Node.js

35 lines (34 loc) 1.3 kB
import { ApiSettings } from "./apiSettings"; import { IncomingMessage, ClientRequest } from "http"; import { RequestOptions } from "https"; import { InputSource, PageOptions } from "../input"; export interface EndpointResponse { messageObj: IncomingMessage; data: { [key: string]: any; }; } /** * Base endpoint for the Mindee API. */ export declare abstract class BaseEndpoint { /** Settings relating to the API. */ settings: ApiSettings; /** Entire root of the URL for API calls. */ urlRoot: string; protected constructor(settings: ApiSettings, urlRoot: string); /** * Cuts a document's pages according to the given options. * @param inputDoc input document. * @param pageOptions page cutting options. */ static cutDocPages(inputDoc: InputSource, pageOptions: PageOptions): Promise<void>; /** * Reads a response from the API and processes it. * @param options options related to the request itself. * @param resolve the resolved response * @param reject promise rejection reason. * @returns the processed request. */ static readResponse(options: RequestOptions, resolve: (value: EndpointResponse | PromiseLike<EndpointResponse>) => void, reject: (reason?: any) => void): ClientRequest; }