-
Notifications
You must be signed in to change notification settings - Fork 8
/
api.go
34 lines (29 loc) · 1.03 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package deepl
import "time"
type translateResponse struct {
Translations []Translation `json:"translations"`
}
// Translation is a translation result from deepl.
type Translation struct {
DetectedSourceLanguage string `json:"detected_source_language"`
Text string `json:"text"`
// BilledCharacters has the value only if ShowBilledChars(true) option was set.
BilledCharacters int `json:"billed_characters"`
}
// Glossary as per
// https://www.deepl.com/docs-api/managing-glossaries/creating-a-glossary/
type Glossary struct {
GlossaryID string `json:"glossary_id"`
Name string `json:"name"`
Ready bool `json:"ready"`
SourceLang string `json:"source_lang"`
TargetLang string `json:"target_lang"`
CreationTime time.Time `json:"creation_time"`
EntryCount int `json:"entry_count"`
}
// A GlossaryEntry represents a single source→target entry in a glossary. This
// is serialized to/from tab-separated values for DeepL.
type GlossaryEntry struct {
Source string
Target string
}