UNPKG

geneea-nlp-client

Version:

The TypeScript Client for Geneea Interpretor G3 API.

31 lines (30 loc) 1.27 kB
import { Analysis } from ".."; import { Request } from "./request"; /** * A client for the Geneea NLP REST (General API V3). */ export declare class Client { readonly url: string; readonly userKey: string; readonly timeout: number; /** The default address of the Geneea NLP G3 API. */ static readonly DEFAULT_URL = "https://api.geneea.com/v3/analysis"; static readonly DEFAULT_TIMEOUT_MILLISEC = 600000; private httpAgent; constructor(url: string, userKey: string, timeout: number); /** * Call Geneea G3 API. * @param request A Request instance (data to analyze and parameters). * @returns A promise that resolves to the result as an Analysis object. */ analyze(request: Request): Promise<Analysis>; /** * Create Geneea G3 Client. * * @param url URL of the Interpretor API to use. * @param userKey API user key; if not specified, loaded from `GENEEA_API_KEY` environment variable. * @param timeout A number specifying the socket timeout in milliseconds. This will set the timeout before the socket is connected. [DEFAULT_TIMEOUT_SEC] if not set. * @returns A G3 client. */ static create(url?: string, userKey?: string | undefined, timeout?: number): Client; }