UNPKG

ai-fetcher

Version:

A Node.js package that provides integration with popular language models. It is designed to facilitate easy and efficient ai-fetching tasks for your application.

33 lines (32 loc) 1.14 kB
import type { DeepLResult } from "../types"; export declare class DeepL { private apiKey; private isPro; private headers; readonly url: string; readonly endpoints: { free: string; pro: string; }; /** * Construcs a new instance of DeepL class * @param deepLKey: string - The user's DeepL authentication key * @param isPro (optional) - boolean. Specifies if the user is using the pro version api */ constructor(deepLKey: string, isPro?: boolean); /** * Translate the given text fron one language to another * The input is an JavaScript Object * @param from (optional): string - Should be one of the supported language. * @param to: string - Should be one of the supported language. * @param text: string[] | string - The source text(s) to be translated. * * @returns A Promise that resolves to a DeepLResult containing the translation * @throws An error if the API request fails */ translate({ from, to, text, }: { from?: string; to: string; text: string[] | string; }): Promise<DeepLResult>; }