import { Translator } from './translator'; import { DeepLClientOptions, WriteResult, MultilingualGlossaryDictionaryEntries, MultilingualGlossaryInfo, MultilingualGlossaryDictionaryInfo, GlossaryId, StyleRuleInfo, StyleId, CustomInstruction, TranslationMemoryInfo } from './types'; export type CustomInstructionRequestBody = { label: string; prompt: string; source_language?: string; }; export type CreateStyleRuleRequestBody = { name: string; language: string; configured_rules?: Record>; custom_instructions?: CustomInstructionRequestBody[]; }; export declare enum WritingStyle { ACADEMIC = "academic", BUSINESS = "business", CASUAL = "casual", DEFAULT = "default", PREFER_ACADEMIC = "prefer_academic", PREFER_BUSINESS = "prefer_business", PREFER_CASUAL = "prefer_casual", PREFER_SIMPLE = "prefer_simple", SIMPLE = "simple" } export declare enum WritingTone { CONFIDENT = "confident", DEFAULT = "default", DIPLOMATIC = "diplomatic", ENTHUSIASTIC = "enthusiastic", FRIENDLY = "friendly", PREFER_CONFIDENT = "prefer_confident", PREFER_DIPLOMATIC = "prefer_diplomatic", PREFER_ENTHUSIASTIC = "prefer_enthusiastic", PREFER_FRIENDLY = "prefer_friendly" } export declare class DeepLClient extends Translator { constructor(authKey: string, options?: DeepLClientOptions); rephraseText(texts: T, targetLang?: string | null, writingStyle?: string | null, tone?: string | null): Promise; /** * Creates a glossary with given name with all of the specified * dictionaries, each with their own language pair and entries. The * glossary may be used in the translateText functions. * * Only certain language pairs are supported. The available language pairs * can be queried using getGlossaryLanguages(). Glossaries are not * regional specific: a glossary with target language EN may be used to * translate texts into both EN-US and EN-GB. * * This function requires the glossary entries for each dictionary to be * provided as a dictionary of source-target terms. To create a glossary * from a CSV file downloaded from the DeepL website, see * {@link createMultilingualGlossaryWithCsv}. * * @param name user-defined name to attach to glossary. * @param glossaryDicts the dictionaries of the glossary, see {@link MultilingualGlossaryDictionaryEntries}. * @return {Promise} object with details about the newly created glossary. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API */ createMultilingualGlossary(name: string, glossaryDicts: MultilingualGlossaryDictionaryEntries[]): Promise; /** * Creates a multilingual glossary with the given name using entries from a CSV file. * The CSV file must contain two columns: source terms and target terms. * The glossary may be used in the translateText() functions. * * Only certain language pairs are supported. The available language pairs * can be queried using getGlossaryLanguages(). Glossaries are not * regional specific: a glossary with target language EN may be used to * translate texts into both EN-US and EN-GB. * * @param name User-defined name to attach to the glossary. * @param sourceLanguageCode Source language code for the glossary. * @param targetLanguageCode Target language code for the glossary. * @param csvContent String in CSV format containing the entries. * @returns {Promise} Object with details about the newly created glossary. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ createMultilingualGlossaryWithCsv(name: string, sourceLanguageCode: string, targetLanguageCode: string, csvContent: string): Promise; /** * Retrieves information about the glossary with the specified ID. * This does not retrieve the glossary entries. * @param glossaryId ID of glossary to retrieve. * @returns {Promise} object with details about the specified glossary. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ getMultilingualGlossary(glossaryId: string): Promise; /** * Retrieves the dictionary entries for a specific glossary and language pair. * * If the source and target language codes are specified, there should be at most one dictionary returned. * * @param glossary The ID of the glossary or MultilingualGlossaryInfo object to query. * @param sourceLanguageCode Source language code of the dictionary. * @param targetLanguageCode Target language code of the dictionary. * @returns {Promise} Object containing the dictionary entries. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. * @throws {GlossaryNotFoundError} If no dictionary is found for the given source and target language codes. */ getMultilingualGlossaryDictionaryEntries(glossary: GlossaryId | MultilingualGlossaryInfo, sourceLanguageCode: string, targetLanguageCode: string): Promise; /** * Retrieves a list of all multilingual glossaries available for the authenticated user. * * @returns {Promise} An array of objects containing details about each glossary. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ listMultilingualGlossaries(): Promise; /** * Deletes the glossary with the specified ID or MultilingualGlossaryInfo object. * @param glossary The ID of the glossary or MultilingualGlossaryInfo object to delete. * @throws {Error} If the glossaryId is empty. * @throws {DeepLError} If the glossary could not be deleted. */ deleteMultilingualGlossary(glossary: GlossaryId | MultilingualGlossaryInfo): Promise; /** * Deletes a specific dictionary from a multilingual glossary based on the source and target language codes. * * @param glossary ID of the glossary or MultilingualGlossaryInfo object from which the dictionary will be deleted. * @param sourceLanguageCode Source language code of the dictionary to delete. * @param targetLanguageCode Target language code of the dictionary to delete. * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ deleteMultilingualGlossaryDictionary(glossary: GlossaryId | MultilingualGlossaryInfo, sourceLanguageCode: string, targetLanguageCode: string): Promise; /** * Replaces the dictionary entries for a specific source and target language pair in a multilingual glossary. * * @param glossary ID of the glossary or MultilingualGlossaryInfo object from which the dictionary will be deleted. * @param sourceLanguageCode Source language code of the dictionary to replace. * @param targetLanguageCode Target language code of the dictionary to replace. * @param entries Dictionary entries to replace, formatted as a string in TSV format. * @returns {Promise} Object containing details about the updated dictionary. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ replaceMultilingualGlossaryDictionary(glossary: GlossaryId | MultilingualGlossaryInfo, glossaryDict: MultilingualGlossaryDictionaryEntries): Promise; /** * Replaces the dictionary entries for a specific source and target language pair in a multilingual glossary * using entries from a CSV file. * * @param glossary ID of the glossary or MultilingualGlossaryInfo object from which the dictionary will be deleted. * @param sourceLanguageCode Source language code of the dictionary to replace. * @param targetLanguageCode Target language code of the dictionary to replace. * @param csvContent String in CSV format containing the new entries. * @returns {Promise} Object containing details about the updated dictionary. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ replaceMultilingualGlossaryDictionaryWithCsv(glossary: GlossaryId | MultilingualGlossaryInfo, sourceLanguageCode: string, targetLanguageCode: string, csvContent: string): Promise; /** * Updates the name of a multilingual glossary. * * @param glossary ID of the glossary or MultilingualGlossaryInfo object from which the dictionary will be deleted. * @param name New name for the glossary. * @returns {Promise} Object containing details about the updated glossary. * * @throws {ArgumentError} If the name is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ updateMultilingualGlossaryName(glossary: GlossaryId | MultilingualGlossaryInfo, name: string): Promise; /** * Updates the dictionary entries for a specific source and target language pair in a multilingual glossary. * * @param glossary ID of the glossary or MultilingualGlossaryInfo object to update. * @param glossaryDict The new or updated glossary dictionary. * @returns {Promise} Object containing details about the updated glossary. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ updateMultilingualGlossaryDictionary(glossary: GlossaryId | MultilingualGlossaryInfo, glossaryDict: MultilingualGlossaryDictionaryEntries): Promise; /** * Updates the dictionary entries for a specific source and target language pair in a multilingual glossary * using entries from a CSV file. * * @param glossary ID of the glossary or MultilingualGlossaryInfo object to update. * @param sourceLanguageCode Source language code of the dictionary to update. * @param targetLanguageCode Target language code of the dictionary to update. * @param csvContent String in CSV format containing the new entries. * @returns {Promise} Object containing details about the updated glossary. * * @throws {ArgumentError} If any argument is invalid. * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ updateMultilingualGlossaryDictionaryWithCsv(glossary: GlossaryId | MultilingualGlossaryInfo, sourceLanguageCode: string, targetLanguageCode: string, csvContent: string): Promise; /** * Retrieves a list of all style rules available for the authenticated user. * * @param page: Page number for pagination, 0-indexed (optional). * @param pageSize: Number of items per page (optional). * @param detailed: Whether to include detailed configuration rules in the `configuredRules` property (optional). * @returns {Promise} An array of objects containing details about each style rule. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ getAllStyleRules(page?: number, pageSize?: number, detailed?: boolean): Promise; /** * Retrieves a list of available translation memories. The maximum number of translation * memories returned is controlled by pageSize (max 25). * * @param page: Page number for pagination, 0-indexed (optional). * @param pageSize: Number of items per page (optional). * @returns {Promise} An array of objects containing details about each translation memory. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ listTranslationMemories(page?: number, pageSize?: number): Promise; /** * Creates a new style rule. * * @param styleRule: The style rule parameters including name, language, and optional configured_rules and custom_instructions. * @returns {Promise} The created style rule info. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ createStyleRule(styleRule: CreateStyleRuleRequestBody): Promise; /** * Retrieves a single style rule by ID. * * @param styleId: The ID of the style rule to retrieve. * @returns {Promise} The style rule info. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ getStyleRule(styleId: StyleId): Promise; /** * Updates the name of a style rule. * * @param styleId: The ID of the style rule to update. * @param name: The new name for the style rule. * @returns {Promise} The updated style rule info. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ updateStyleRuleName(styleId: StyleId, name: string): Promise; /** * Deletes a style rule. * * @param styleId: The ID of the style rule to delete. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ deleteStyleRule(styleId: StyleId): Promise; /** * Updates the configured rules of a style rule. * * @param styleId: The ID of the style rule to update. * @param configuredRules: The new configured rules mapping. * @returns {Promise} The updated style rule info. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ updateStyleRuleConfiguredRules(styleId: StyleId, configuredRules: Record>): Promise; /** * Creates a custom instruction for a style rule. * * @param styleId: The ID of the style rule. * @param instruction: The custom instruction parameters including label, prompt, and optional source_language. * @returns {Promise} The created custom instruction. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ createStyleRuleCustomInstruction(styleId: StyleId, instruction: CustomInstructionRequestBody): Promise; /** * Retrieves a custom instruction for a style rule. * * @param styleId: The ID of the style rule. * @param instructionId: The ID of the custom instruction. * @returns {Promise} The custom instruction. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ getStyleRuleCustomInstruction(styleId: StyleId, instructionId: string): Promise; /** * Updates a custom instruction for a style rule. * * @param styleId: The ID of the style rule. * @param instructionId: The ID of the custom instruction to update. * @param instruction: The custom instruction parameters including label, prompt, and optional source_language. * @returns {Promise} The updated custom instruction. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ updateStyleRuleCustomInstruction(styleId: StyleId, instructionId: string, instruction: CustomInstructionRequestBody): Promise; /** * Deletes a custom instruction from a style rule. * * @param styleId: The ID of the style rule. * @param instructionId: The ID of the custom instruction to delete. * * @throws {DeepLError} If any error occurs while communicating with the DeepL API. */ deleteStyleRuleCustomInstruction(styleId: StyleId, instructionId: string): Promise; }