Deepl Client
class DeeplClient(authKey: String, httpClientEngine: HttpClientEngine = defaultHttpClientEngine, apiUrl: String? = null, retryConfig: RetryConfig.() -> Unit? = null)(source)
An HTTP Client that allows interaction with the DeepL API.
Parameters
auth Key
Your DeepL API auth token (including the “:fx” suffix for free tokens!).
http Client Engine
Ktor HttpClientEngine to use for web requests. Default varies per build target.
api Url
The base URL where the DeepL API is hosted. Default is the official endpoint and auto-selects between free or pro endpoints.
retry Config
Builder function for changing the way DeeplClient retries failed requests. Requests with a status < 400 are never retried. See RetryConfig for more info.
Constructors
Link copied to clipboard
constructor(authKey: String, httpClientEngine: HttpClientEngine = defaultHttpClientEngine, apiUrl: String? = null, retryConfig: RetryConfig.() -> Unit? = null)
Functions
Link copied to clipboard
suspend fun translate(vararg texts: String, to: TargetLang, from: SourceLang? = null, options: TranslateOptions = TranslateOptions()): TranslateResponse
Link copied to clipboard
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, from: SourceLang): TranslateResponse
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, options: TranslateOptions = TranslateOptions()): TranslateResponse
suspend fun DeeplClient.translate(text: String, to: TargetLang, options: TranslateOptions = TranslateOptions()): Translation
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, context: String, options: TranslateOptions = TranslateOptions()): TranslateResponse
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, from: SourceLang, context: String): TranslateResponse
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, from: SourceLang? = null, buildOptions: TranslateOptions.() -> Unit = {}): TranslateResponse
suspend fun DeeplClient.translate(text: String, to: TargetLang, context: String, options: TranslateOptions = TranslateOptions()): Translation
suspend fun DeeplClient.translate(text: String, to: TargetLang, from: SourceLang, context: String): Translation
suspend fun DeeplClient.translate(text: String, to: TargetLang, from: SourceLang? = null, buildOptions: TranslateOptions.() -> Unit = {}): Translation
suspend fun DeeplClient.translate(text: String, to: TargetLang, from: SourceLang? = null, options: TranslateOptions = TranslateOptions()): Translation
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, from: SourceLang? = null, context: String, buildOptions: TranslateOptions.() -> Unit = {}): TranslateResponse
suspend fun DeeplClient.translate(vararg texts: String, to: TargetLang, from: SourceLang? = null, context: String, options: TranslateOptions = TranslateOptions()): TranslateResponse
suspend fun DeeplClient.translate(text: String, to: TargetLang, from: SourceLang? = null, context: String, buildOptions: TranslateOptions.() -> Unit = {}): Translation
suspend fun DeeplClient.translate(text: String, to: TargetLang, from: SourceLang? = null, context: String, options: TranslateOptions = TranslateOptions()): Translation
Link copied to clipboard
suspend fun translateDocument(content: String, fileName: String, to: TargetLang, from: SourceLang? = null, formality: Formality? = null): DocumentTranslation
Link copied to clipboard
suspend fun translateDocumentText(content: String, fileName: String, to: TargetLang, from: SourceLang? = null, formality: Formality? = null): String
Link copied to clipboard
suspend fun translateText(vararg texts: String, to: TargetLang, from: SourceLang? = null, options: TranslateOptions = TranslateOptions()): List<String>
Link copied to clipboard
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, from: SourceLang): List<String>
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, options: TranslateOptions = TranslateOptions()): List<String>
suspend fun DeeplClient.translateText(text: String, to: TargetLang, options: TranslateOptions = TranslateOptions()): String
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, context: String, options: TranslateOptions = TranslateOptions()): List<String>
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, from: SourceLang, context: String): List<String>
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, from: SourceLang? = null, buildOptions: TranslateOptions.() -> Unit = {}): List<String>
suspend fun DeeplClient.translateText(text: String, to: TargetLang, context: String, options: TranslateOptions = TranslateOptions()): String
suspend fun DeeplClient.translateText(text: String, to: TargetLang, from: SourceLang, context: String): String
suspend fun DeeplClient.translateText(text: String, to: TargetLang, from: SourceLang? = null, buildOptions: TranslateOptions.() -> Unit = {}): String
suspend fun DeeplClient.translateText(text: String, to: TargetLang, from: SourceLang? = null, options: TranslateOptions = TranslateOptions()): String
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, from: SourceLang? = null, context: String, buildOptions: TranslateOptions.() -> Unit = {}): List<String>
suspend fun DeeplClient.translateText(vararg texts: String, to: TargetLang, from: SourceLang? = null, context: String, options: TranslateOptions = TranslateOptions()): List<String>
suspend fun DeeplClient.translateText(text: String, to: TargetLang, from: SourceLang? = null, context: String, buildOptions: TranslateOptions.() -> Unit = {}): String
suspend fun DeeplClient.translateText(text: String, to: TargetLang, from: SourceLang? = null, context: String, options: TranslateOptions = TranslateOptions()): String