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§
Macros§
- impl_
requester - A self implemented Type Builder
Structs§
- DeepL
Api - A struct that contains necessary data for runtime. Data is stored in
Arc
, so it is cheap to clone in your App’s code. - DeepL
ApiBuilder - The builder struct. DO NOT USE IT IN YOUR APPS
- Document
Status Resp - Response from api/v2/document/$ID
- Lang
Info - Information about a supported language
- Translate
Text Resp - Response from basic translation API
- Upload
Document Resp - Response from api/v2/document
- Usage
Response - Response from the usage API
Enums§
- Document
Translate Status - Possible value of the document translate status
- Error
- Representing error during interaction with DeepL
- Formality
- Formality preference for translation
- Lang
- Languages
- Lang
Convert Error - Lang
Type - Language type used to request supported languages
- TagHandling
- Sets which kind of tags should be handled. Options currently available