Expand description
§DeepL Api
deepl-rs is a web request library for making requests to the DeepL API
endpoint easier. It provides types wrapping to help developer gain correctness
confidence.
§Usage
[dependencies]
deepl = "0.7"use deepl::{DeepLApi, Lang};
let api = DeepLApi::with("YOUR AUTH KEY").new();
let translated = api.translate_text("Hello World", Lang::ZH).await.unwrap();
let sentences = translated.translations;
assert_eq!(sentences[0].text, "你好,世界");Read examples for more usage.
§Collaboration
If you find any bugs in this project or feel confused about any part of the code, feel free to open new issue.
DeepL API rapidly update and change, and this crate can’t catch up in-time.
Feel free to file new issue if deepl-rs mismatch with the DeepL API.
If you want to submit some code modification but don’t know how to setup the
code environment, you can follow the Nix
Installation
and enable flakes support. Then
simply run nix develop in the project root, all the build dependencies will
setup for you.
§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
- Model
Type - Sets the language model to use: allows to choose an improved “next-gen” model
- TagHandling
- Sets which kind of tags should be handled. Options currently available