https://github.com/candy12t/go-deepl
Unofficial DeepL API client for Go.
https://github.com/candy12t/go-deepl
api-client deepl go
Last synced: 5 months ago
JSON representation
Unofficial DeepL API client for Go.
- Host: GitHub
- URL: https://github.com/candy12t/go-deepl
- Owner: candy12t
- License: mit
- Created: 2024-01-08T03:41:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-03T06:35:21.000Z (over 2 years ago)
- Last Synced: 2024-06-21T20:08:15.793Z (almost 2 years ago)
- Topics: api-client, deepl, go
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deepl - go-deepl - Unofficial DeepL API client for Go (Awesome DeepL / Client Libraries & SDKs)
README
# go-deepl
Unofficial DeepL API client for Go.
## Install
```
go get -u github.com/candy12t/go-deepl@latest
```
## Usage
```go
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"github.com/candy12t/go-deepl"
)
func main() {
authkey := os.Getenv("DEEPL_AUTH_KEY")
client := deepl.NewClient(authkey)
translatetext, err := client.TranslateText(context.Background(), []string{"Hello world"}, "JA", deepl.TranslateOption{SourceLang: "EN"})
if err != nil {
log.Fatal(err)
}
b, err := json.Marshal(translatetext)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(b))
}
```
## References
- [DeepL API](https://www.deepl.com/en/docs-api)
## APIs
### Translate Text
- [x] POST /v2/translate
### Translate Documents
- [x] POST /v2/document
- [x] POST /v2/document/{document_id}
- [x] POST /v2/document/{document_id}/result
### Manage Glossaries
- [x] GET /v2/glossary-language-pairs
- [x] POST /v2/glossaries
- [x] GET /v2/glossaries
- [x] GET /v2/glossaries/{glossary_id}
- [x] DELETE /v2/glossaries/{glossary_id}
- [x] GET /v2/glossaries/{glossary_id}/entries
### General
- [x] GET /v2/usage
- [x] GET /v2/languages
## License
MIT License