Skip to content
Batua API libraries
Go Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
go
python
LICENSE
README.md

README.md

Batua.eus API libraries

In this repository, you can find example ready-to-use libraries. For more information, please visit https://www.batua.eus/api

Go

Functions in package batua

Translate(text, fromlang, tolang, auth string) (TranslationResponse, error)
GetQuota(auth string) (QuotaResponse, error)
Feedback(id, correction string, evaluation int, auth string) (FeedbackResponse, error)

Example

Get the package

go get -u github.com/Vicomtech/batua-api-lib/go/src/batua

Import:

import("github.com/Vicomtech/batua-api-lib/go/src/batua")

Send a translation:

if response, err := batua.Translate("kaixo! zer moduz?", "eu", "es", "key"); err != nil {
    fmt.Println(response.TranslatedText)
}

Get used quota:

if responseQuota, err := batua.GetQuota("apikey"); err != nil {
    fmt.Println(responseQuota.ConsumedQuota)
}

Feedback:

if responseFeedback, err := batua.Feedback(translationResponse.FeedbackId, "hau horrela da", 1, "apikey"); err != nil {
    fmt.Println(responseFeedback.Message)
}

Python 3

Functions in "Batua" package

getTranslation(text, fromlang, tolang)
getQuota()
sendFeedback(id, correction, evaluation)

An exception will be thrown if any error detected.

Example

Install the package

pip install https://github.com/Vicomtech/batua-api-lib/blob/master/python/dist/batua-pkg-vicomtech-1.0.0.tar.gz?raw=true

Import:

import batua

Initialize with your api key:

batuapi = batua.Batua("apikey")

Make a translation:

batuapi.getTranslation("kaixo! zer moduz?", "eu", "es")

Get quota:

batuapi.getQuota()

Send feedback:

batuapi.sendFeedback("id from translation, "corrected text", 1)
You can’t perform that action at this time.