Crate deepl

Source
Expand description

§deepl-rs

Deepl-rs is a simple library for making requests to the DeepL API endpoint easier. And it also provides types wrapping to guarantee runtime safety.

This is still a WORK IN PROGRESS library, please open an issue on GitHub to request features. Be aware breaking changes will be released frequently.

§Usage

use deepl::DeepLApi;

let key = std::env::var("DEEPL_API_KEY").unwrap();
let api = DeepLApi::with(&key).new();
let response = api.translate_text("Hello World", Lang::ZH).await.unwrap();

assert!(!response.translations.is_empty());

See DeepLApi for detailed usage.

§License

This project is licensed under MIT license.

Re-exports§

pub use reqwest;

Modules§

glossary

Macros§

impl_requester
A self implemented Type Builder

Structs§

DeepLApi
A struct that contains necessary data for runtime. Data is stored in Arc, so it is cheap to clone in your App’s code.
DeepLApiBuilder
The builder struct. DO NOT USE IT IN YOUR APPS
DocumentStatusResp
Response from api/v2/document/$ID
LangInfo
Information about a supported language
TranslateTextResp
Response from basic translation API
UploadDocumentResp
Response from api/v2/document
UsageResponse
Response from the usage API

Enums§

DocumentTranslateStatus
Possible value of the document translate status
Error
Representing error during interaction with DeepL
Formality
Formality preference for translation
Lang
Languages
LangConvertError
LangType
Language type used to request supported languages
TagHandling
Sets which kind of tags should be handled. Options currently available