diff --git a/README.md b/README.md index c4e5ec8..348f8cc 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,64 @@ # go-deepl +Unofficial DeepL API client for Go. + +## 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 -- [ ] translate documents -- [ ] manage glossaries -- [x] check usage and limits -- [ ] retrieve supported languages +### Translate Text + +- [x] POST /v2/translate + +### Translate Documents + +- [ ] POST /v2/document +- [ ] POST /v2/document/{document_id} +- [ ] 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