gleepl - A Gleam client for the DeepL API

Package Version Hex Docs

Installation

gleam add gleepl

Usage

import gleepl
import gleepl/endpoints
import gleepl/langs

gleepl.new()
|> gleepl.set_auth_key("YOUR_AUTH_KEY or from dot_env")
|> gleepl.set_endpoint(endpoints.free)
|> gleepl.set_from(langs.english)
|> gleepl.set_to(langs.french)
|> gleepl.translate("hello, friend!")

// -> Ok("Bonjour, mon ami !")

Usage with dot_env

import dot_env
import dot_env/env
import gleepl
import gleepl/endpoints
import gleepl/langs

dot_env.load()
let assert Ok(auth_key) = env.get("DEEPL_AUTH_KEY")

gleepl.new()
|> gleepl.set_auth_key(auth_key)
|> gleepl.set_endpoint(endpoints.free)
|> gleepl.set_from(langs.english)
|> gleepl.set_to(langs.french)
|> gleepl.translate("hello, friend!")

// -> Ok("Bonjour, mon ami !")

Development

# do not forget to add your DEEPL_AUTH_KEY to .env

gleam test  # Run the tests
Search Document