[][src]Struct deepl_api::DeepL

pub struct DeepL { /* fields omitted */ }

The main API entry point representing a DeepL developer account with an associated API key.

Example

See Example.

Error Handling

None of the functions will panic. Instead, the API methods usually return a Result which may contain an Error of one of the defined ErrorKinds with more information about what went wrong.

If you get an AuthorizationError, then something was wrong with your API key, for example.

Implementations

impl DeepL[src]

Implements the actual REST API. See also the online documentation.

pub fn new(api_key: String) -> DeepL[src]

Use this to create a new DeepL API client instance where multiple function calls can be performed. A valid api_key is required.

Should you ever need to use more than one DeepL account in our program, then you can create one instance for each account / API key.

pub fn usage_information(&self) -> Result<UsageInformation>[src]

Retrieve information about API usage & limits. This can also be used to verify an API key without consuming translation contingent.

See also the vendor documentation.

pub fn source_languages(&self) -> Result<LanguageList>[src]

Retrieve all currently available source languages.

See also the vendor documentation.

pub fn target_languages(&self) -> Result<LanguageList>[src]

Retrieve all currently available target languages.

See also the vendor documentation.

pub fn translate(
    &self,
    options: Option<TranslationOptions>,
    text_list: TranslatableTextList
) -> Result<Vec<TranslatedText>>
[src]

Translate one or more text chunks at once. You can pass in optional translation flags if you need non-default behaviour.

Please see the parameter documentation and the vendor documentation for details.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.