-
Notifications
You must be signed in to change notification settings - Fork 3
/
request.go
61 lines (49 loc) · 1.01 KB
/
request.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
package omp
import (
"encoding/xml"
)
// OMP Response Status .
const (
StatusOK int = 200
)
// request / response interface .
type requestIface interface {
}
type responseIface interface {
GetStatus() int
GetStatusText() string
}
// request / response base .
type requestBase struct {
}
type responseBase struct {
Status int `xml:"status,attr,omitempty"`
StatusText string `xml:"status_text,attr,omitempty"`
}
func (r *responseBase) GetStatus() int {
return r.Status
}
func (r *responseBase) GetStatusText() string {
return r.StatusText
}
// Auth .
type requestAuth struct {
requestBase
XMLName xml.Name `xml:"authenticate"`
Credentials struct {
Username string `xml:"username,omitempty"`
Password string `xml:"password,omitempty"`
} `xml:"credentials,omitempty"`
}
type responseAuth struct {
responseBase
}
// Version .
type requestVersion struct {
requestBase
XMLName xml.Name `xml:"get_version"`
}
type responseVersion struct {
responseBase
Version string `xml:"version,omitempty"`
}