-
Notifications
You must be signed in to change notification settings - Fork 2
/
xpath_request.go
61 lines (50 loc) · 1.08 KB
/
xpath_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 homehub
type xpathRequest struct {
genericRequest
}
func newXPathRequest(authData *authData, xpath string, method string, value interface{}) (req *xpathRequest) {
var (
caps *capabilityFlags
options *interfaceOptions
params *parameters
)
authData.requestCount++
if method == methodGetValue {
caps = &capabilityFlags{
Interface: true,
}
options = &interfaceOptions{
CapabilityFlags: *caps,
}
} else {
params = ¶meters{
Value: value,
}
}
a := action{
ID: 0,
Method: method,
XPath: xpath,
InterfaceOptions: options,
Parameters: params,
}
var actions []action
actions = append(actions, a)
requestBody := newRequestBody(authData, actions)
return &xpathRequest{
genericRequest: genericRequest{
*requestBody,
*authData,
},
}
}
func newMultiXPathRequest(authData *authData, actions []action) (req *xpathRequest) {
authData.requestCount++
requestBody := newRequestBody(authData, actions)
return &xpathRequest{
genericRequest: genericRequest{
*requestBody,
*authData,
},
}
}