mindee
Version:
Mindee Client Library for Node.js
60 lines (59 loc) • 2.71 kB
TypeScript
import { ApiSettings } from "./apiSettings.js";
import { Dispatcher } from "undici";
import { BaseParameters } from "../../v2/index.js";
import { JobResponse } from "../../v2/parsing/index.js";
import { InputSource } from "../../input/index.js";
import { BaseProduct } from "../../v2/product/baseProduct.js";
import { SearchResponse } from "../../v2/parsing/search/index.js";
/**
* Mindee V2 API handler.
*/
export declare class MindeeApiV2 {
#private;
settings: ApiSettings;
constructor(dispatcher?: Dispatcher, apiKey?: string);
/**
* Search for models available to the account.
* @param name Optional name filter.
* @param modelType Optional model type filter.
* @returns a `Promise` containing the search response.
*/
reqGetSearchModel(name?: string, modelType?: string): Promise<SearchResponse>;
/**
* Sends a document to the inference queue.
* @param product Product to enqueue.
* @param inputSource Local or remote file as an input.
* @param params {ExtractionParameters} parameters relating to the enqueueing options.
*/
reqPostProductEnqueue(product: typeof BaseProduct, inputSource: InputSource, params: BaseParameters): Promise<JobResponse>;
/**
* Get the specified Job by its ID.
* Throws an error if the server's response contains an error.
* @param jobId The Job ID as returned by the enqueue request.
* @returns a `Promise` containing the job response.
*/
reqGetJobById(jobId: string): Promise<JobResponse>;
/**
* Get the specified Job from a polling URL.
* Throws an error if the server's response contains an error.
* @param pollingUrl The polling URL as returned by a Job's pollingUrl property.
* @returns a `Promise` containing the job response.
*/
reqGetJobByUrl(pollingUrl: string): Promise<JobResponse>;
/**
* Get the result of a queued document from the API.
* Throws an error if the server's response contains an error.
* @param product
* @param inferenceId The inference ID for the result.
* @returns a `Promise` containing the parsed result.
*/
reqGetProductResultById<P extends typeof BaseProduct>(product: P, inferenceId: string): Promise<InstanceType<P["responseClass"]>>;
/**
* Get the result of a queued document from the API.
* Throws an error if the server's response contains an error.
* @param product
* @param url The URL as returned by a Job's resultUrl property.
* @returns a `Promise` containing the parsed result.
*/
reqGetProductResultByUrl<P extends typeof BaseProduct>(product: P, url: string): Promise<InstanceType<P["responseClass"]>>;
}