https://github.com/michimani/deepl-sdk-go
This is a an unofficial Go SDK for using the DeepL API.
https://github.com/michimani/deepl-sdk-go
deepl golang sdk
Last synced: about 1 month ago
JSON representation
This is a an unofficial Go SDK for using the DeepL API.
- Host: GitHub
- URL: https://github.com/michimani/deepl-sdk-go
- Owner: michimani
- License: mit
- Created: 2021-06-06T09:48:52.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T15:12:46.000Z (9 months ago)
- Last Synced: 2025-03-24T13:21:16.757Z (2 months ago)
- Topics: deepl, golang, sdk
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
deepl-sdk-go
===This is an unofficial Go SDK for using the DeepL API.
# Usage
```bash
go get github.com/michimani/deepl-sdk-go
```# Sample
```go
package mainimport (
"context"
"fmt"
"os""github.com/michimani/deepl-sdk-go"
"github.com/michimani/deepl-sdk-go/params"
"github.com/michimani/deepl-sdk-go/types"
)func main() {
client, err := deepl.NewClient()
if err != nil {
fmt.Println(err)
return
}text := []string{
"こんにちは",
"これはサンプルテキストです。",
}
params := ¶ms.TranslateTextParams{
TargetLang: types.TargetLangEN,
Text: text,
}res, errRes, err := c.TranslateText(context.TODO(), params)
if err != nil {
fmt.Println(err)
}if errRes != nil {
fmt.Println("ErrorResponse", errRes.Message)
}for i := range res.Translations {
fmt.Printf("%s -> %s\n", text[i], res.Translations[i].Text)
}
}
``````bash
$ DEEPL_API_AUTHN_KEY="your-authn-key" DEEPL_API_PLAN="free" go run main.goこんにちは -> hello
これはサンプルテキストです。 -> This is a sample text.
```