-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.go
304 lines (268 loc) · 10.7 KB
/
structs.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
package pipeline
import (
"encoding/xml"
)
//Error with information from the server
type Error struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data error"`
Description string `xml:"http://www.daisy.org/ns/pipeline/data description"`
Trace string `xml:"http://www.daisy.org/ns/pipeline/data trace"`
Query string `xml:"query,attr"`
}
//More info TODO link to wiki
//Alive struct defined from the xmls
//TODO link to wiki
type Alive struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data alive"`
Authentication bool `xml:"authentication,attr"` //Indicates if the framework is expecting authentication
FsAllow bool `xml:"localfs,attr"` //Fwk allows access to the local fs
Version string `xml:"version,attr"` //Version of the pipeline framework
}
//TODO link to wiki
type Scripts struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data scripts"`
Scripts []Script `xml:"http://www.daisy.org/ns/pipeline/data script"` //List of scripts available
Href string `xml:"href,attr"` //Url used to perform this call
}
//Script struct
type Script struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data script"`
Nicename string `xml:"http://www.daisy.org/ns/pipeline/data nicename,omitempty"`
Description string `xml:"http://www.daisy.org/ns/pipeline/data description,omitempty"`
Version string `xml:"http://www.daisy.org/ns/pipeline/data version,omitempty"`
Homepage string `xml:"http://www.daisy.org/ns/pipeline/data homepage,omitempty"`
Inputs []Input `xml:"http://www.daisy.org/ns/pipeline/data input,omitempty"`
Options []Option `xml:"http://www.daisy.org/ns/pipeline/data option,omitempty"`
Href string `xml:"href,attr"`
Id string `xml:"id,attr,omitempty"`
}
type Option struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data option"`
Required bool `xml:"required,attr,omitempty"`
Sequence bool `xml:"sequence,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
NiceName string `xml:"nicename,attr,omitempty"`
Ordered bool `xml:"ordered,attr,omitempty"`
Mediatype string `xml:"mediaType,attr,omitempty"`
ShortDesc string `xml:"-"`
LongDesc string `xml:"desc,attr,omitempty"`
TypeAttr string `xml:"type,attr,omitempty"`
Type DataType `xml:"-"`
Default string `xml:"default,attr,omitempty"`
OutputType string `xml:"optionType,attr,omitempty"`
Separator string `xml:"separator,attr,omitempty"`
Value string `xml:",chardata"`
Items []Item
}
type DataType interface{}
type Choice struct {
XmlDefinition string
Values []DataType
}
type Value struct {
XmlDefinition string
Documentation string
Value string
}
type Pattern struct {
XmlDefinition string
Pattern string
Documentation string
}
type AnyFileURI struct {
XmlDefinition string
Documentation string
}
type AnyDirURI struct {
XmlDefinition string
Documentation string
}
type XsAnyURI struct {
XmlDefinition string
Documentation string
}
type XsBoolean struct {
XmlDefinition string
Documentation string
}
type XsInteger struct {
XmlDefinition string
Documentation string
}
type XsNonNegativeInteger struct {
XmlDefinition string
Documentation string
}
type XsString struct {
XmlDefinition string
Documentation string
}
type Input struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data input"`
ShortDesc string `xml:"-"`
LongDesc string `xml:"desc,attr,omitempty"`
Mediatype string `xml:"mediaType,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
NiceName string `xml:"nicename,attr,omitempty"`
Sequence bool `xml:"sequence,attr,omitempty"`
Required bool `xml:"required,attr,omitempty"`
Items []Item
}
type Item struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data item"`
Value string `xml:"value,attr"`
}
type Callback struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data callback"`
Href string `xml:"href,attr"`
Frequency string `xml:"frequency,attr"`
Type string `xml:"type,attr"`
}
type JobRequest struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data jobRequest"`
Nicename string `xml:"http://www.daisy.org/ns/pipeline/data nicename,omitempty"`
BatchId string `xml:"http://www.daisy.org/ns/pipeline/data batchId,omitempty"`
Priority string `xml:"http://www.daisy.org/ns/pipeline/data priority,omitempty"`
Script Script `xml:"http://www.daisy.org/ns/pipeline/data script"`
Inputs []Input `xml:"http://www.daisy.org/ns/pipeline/data input,omitempty"`
Options []Option `xml:"http://www.daisy.org/ns/pipeline/data option,omitempty"`
Callback []Callback `xml:"http://www.daisy.org/ns/pipeline/data callback,omitempty"`
}
type Job struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data job"`
Nicename string `xml:"http://www.daisy.org/ns/pipeline/data nicename"`
BatchId string `xml:"http://www.daisy.org/ns/pipeline/data batchId"`
Script `xml:"http://www.daisy.org/ns/pipeline/data script"`
Messages Messages `xml:"http://www.daisy.org/ns/pipeline/data messages"`
Log Log `xml:"http://www.daisy.org/ns/pipeline/data log"`
Results Results `xml:"http://www.daisy.org/ns/pipeline/data results"`
Priority string `xml:"priority,attr"`
Status string `xml:"status,attr"`
Href string `xml:"href,attr"`
Id string `xml:"id,attr"`
}
type Result struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data result"`
MimeType string `xml:"mime-type,attr"`
Href string `xml:"href,attr"`
Result []Result `xml:"http://www.daisy.org/ns/pipeline/data result"`
}
type Message struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data message"`
Level string `xml:"level,attr"`
Sequence int `xml:"sequence,attr"`
Content string `xml:"content,attr"`
Message []Message `xml:"http://www.daisy.org/ns/pipeline/data message"`
}
type Log struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data log"`
Href string `xml:"href,attr"`
}
type Messages struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data messages"`
Progress float64 `xml:"progress,attr"`
Message []Message `xml:"http://www.daisy.org/ns/pipeline/data message"`
}
type Results struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data results"`
Result []Result `xml:"http://www.daisy.org/ns/pipeline/data result"`
Href string `xml:"href,attr"`
MimeType string `xml:"mime-type,attr"`
}
type Jobs struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data jobs"`
Jobs []Job `xml:"http://www.daisy.org/ns/pipeline/data job"`
Href string `xml:"href,attr"`
}
//Admin stuff
type Clients struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data clients"`
Clients []Client `xml:"http://www.daisy.org/ns/pipeline/data client"`
Href string `xml:"href,attr"`
}
type Client struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data client"`
Secret string `xml:"secret,attr"`
Href string `xml:"href,attr"`
Role string `xml:"role,attr"`
Id string `xml:"id,attr"`
Contact string `xml:"contact,attr"`
Priority string `xml:"priority,attr"`
}
type Property struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data property"`
BundleName string `xml:"bundleName,attr"`
BundleId string `xml:"bundleId,attr"`
Value string `xml:"value,attr"`
Name string `xml:"name,attr"`
}
type Properties struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data properties"`
Properties []Property `xml:"http://www.daisy.org/ns/pipeline/data property"`
Href string `xml:"href,attr"`
}
type JobSizes struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data jobSizes"`
JobSizes []JobSize `xml:"http://www.daisy.org/ns/pipeline/data jobSize"`
Href string `xml:"href,attr"`
Total int `xml:"total,attr"`
}
type JobSize struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data jobSize"`
Output int `xml:"output,attr"`
Id string `xml:"id,attr"`
Context int `xml:"context,attr"`
Log int `xml:"log,attr"`
}
type Queue struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data queue"`
Jobs []QueueJob `xml:"http://www.daisy.org/ns/pipeline/data job"`
Href string `xml:"href,attr"`
}
type QueueJob struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data job"`
Moveup string `xml:"moveUp,attr"`
Id string `xml:"id,attr"`
ClientPriority string `xml:"clientPriority,attr"`
RelativeTime float64 `xml:"relativeTime,attr"`
JobPriority string `xml:"jobPriority,attr"`
Href string `xml:"href,attr"`
TimeStamp int64 `xml:"timestamp,attr"`
MoveDown string `xml:"moveDown,attr"`
ComputedPriority float64 `xml:"computedPriority,attr"`
}
type StylesheetParametersRequest struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data stylesheetParametersRequest"`
Media Media `xml:"http://www.daisy.org/ns/pipeline/data media,omitempty"`
UserAgentStylesheet UserAgentStylesheet `xml:"http://www.daisy.org/ns/pipeline/data userAgentStylesheet,omitempty"`
// FIXME: in order to omit when empty, change to pointers
// UserStylesheets []File `xml:"http://www.daisy.org/ns/pipeline/data userStylesheets>file"`
// SourceDocument []File `xml:"http://www.daisy.org/ns/pipeline/data sourceDocument>file"`
}
type Media struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data media"`
Value string `xml:"value,attr"`
}
type UserAgentStylesheet struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data userAgentStylesheet"`
Mediatype string `xml:"mediaType,attr"`
}
type File struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data file"`
Href string `xml:"href,attr"`
}
type StylesheetParameters struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data parameters"`
Parameters []StylesheetParameter `xml:"http://www.daisy.org/ns/pipeline/data parameter"`
}
type StylesheetParameter struct {
XMLName xml.Name `xml:"http://www.daisy.org/ns/pipeline/data parameter"`
Name string `xml:"name,attr,omitempty"`
NiceName string `xml:"nicename,attr,omitempty"`
ShortDesc string `xml:"-"`
LongDesc string `xml:"description,attr,omitempty"`
Default string `xml:"default,attr,omitempty"`
TypeAttr string `xml:"type,attr,omitempty"`
Type DataType `xml:"-"`
Value string `xml:"-"`
}