mindee
Version:
Mindee Client Library for Node.js
71 lines (70 loc) • 2.69 kB
TypeScript
import { InputSource } from "../input";
import { ApiSettings } from "./apiSettings";
import { BaseEndpoint, EndpointResponse } from "./baseEndpoint";
import { StringDict } from "../parsing/common";
import { PredictParams } from "./httpParams";
/**
* Endpoint for a product (OTS or Custom).
*/
export declare class Endpoint extends BaseEndpoint {
#private;
/** URL of a product. */
urlName: string;
/** Account owning the product. */
owner: string;
/** Product's version, as a string. */
version: string;
constructor(urlName: string, owner: string, version: string, settings: ApiSettings);
/**
* Changes the url to a workflow ID.
* @param workflowId
*/
useWorkflowId(workflowId: string): void;
/**
* Sends a document to the API and parses out the result.
* Throws an error if the server's response contains one.
* @param {PredictParams} params parameters relating to prediction options.
* @category Synchronous
* @returns a `Promise` containing parsing results.
*/
predict(params: PredictParams): Promise<EndpointResponse>;
/**
* Enqueues a prediction to the API.
* Throws an error if the server's response contains one.
* @param {PredictParams} params parameters relating to prediction options.
* @category Asynchronous
* @returns a `Promise` containing queue data.
*/
predictAsync(params: PredictParams): Promise<EndpointResponse>;
private extractStatusMessage;
/**
* Requests the results of a queued document from the API.
* Throws an error if the server's response contains one.
* @param queueId The document's ID in the queue.
* @category Asynchronous
* @returns a `Promise` containing the parsed result.
*/
getQueuedDocument(queueId: string): Promise<EndpointResponse>;
/**
* Send a feedback
* @param {string} documentId
*/
getDocument(documentId: string): Promise<EndpointResponse>;
/**
* Send a feedback
* @param {string} documentId - ID of the document to send feedback to.
* @param {StringDict} feedback - Feedback object to send.
*/
sendFeedback(documentId: string, feedback: StringDict): Promise<EndpointResponse>;
/**
* Send a file to a prediction API.
* @param input
* @param predictUrl
* @param includeWords
* @param fullText
* @param cropper
* @param rag
* @param workflowId
*/
protected sendFileForPrediction(input: InputSource, predictUrl: string, includeWords?: boolean, fullText?: boolean, cropper?: boolean, rag?: boolean, workflowId?: string | undefined): Promise<EndpointResponse>;
}