-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
120 lines (93 loc) · 2.24 KB
/
types.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package poeditor
import "errors"
//
// Types
//
type Language string
func (t Language) String() string {
return string(t)
}
//
type Action string
func (t Action) String() string {
return string(t)
}
//
type FileType string
func (t FileType) String() string {
return string(t)
}
//
type UpdateType string
func (t UpdateType) String() string {
return string(t)
}
//
// Response types
//
type PoTerm struct {
Term string `json:"term"`
Context string `json:"context"`
}
type response struct {
Status string `json:"status"`
Code string `json:"code"`
Message string `json:"message"`
}
type listElem struct {
PoTerm
Name string `json:"name"`
Code string `json:"code"`
Percentage float32 `json:"percentage"`
}
type details struct {
Parsed int32 `json:"parsed"`
Added int32 `json:"added"`
Deleted int32 `json:"deleted"`
Updated int32 `json:"updated"`
}
type result struct {
Response response `json:"response"`
List []listElem `json:"list"`
Details details `json:"details"`
Item string `json:"item"`
}
//
// Constants
//
const (
apiUrl string = "https://poeditor.com/api/"
actionAvailableLanguages Action = "available_languages"
actionListLanguages Action = "list_languages"
actionListTerms Action = "view_terms"
actionAddTerms Action = "add_terms"
actionDeleteTerms Action = "delete_terms"
actionSyncTerms Action = "sync_terms"
actionExportTerms Action = "export"
actionUploadTerms Action = "upload"
UploadTypeTerms = "terms"
UploadTypeDefinitions UpdateType = "definitions"
UploadTypeTermsDefinitions UpdateType = "terms_definitions"
LanguageNULL Language = ""
LanguageRU Language = "ru"
LanguageEN Language = "en"
FileTypePo FileType = "po"
FileTypePot FileType = "pot"
FileTypeMo FileType = "mo"
FileTypeXls FileType = "xls"
FileTypeCsv FileType = "csv"
FileTypeRews FileType = "resw"
FileTypeResx FileType = "resx"
FileTypeAndroidStrings FileType = "android_strings"
FileTypeAccpeStrings FileType = "apple_strings"
FileTypeXliff FileType = "xliff"
FileTypeProperties FileType = "properties"
FileTypeKeyValueJson FileType = "key_value_json"
FileTypeJson FileType = "json"
)
//
// Errors
//
var (
ErrPoeErrorResponse = errors.New("Ошибка запроса к https://poeditor.com/api/")
)