-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.go
More file actions
40 lines (35 loc) · 867 Bytes
/
request.go
File metadata and controls
40 lines (35 loc) · 867 Bytes
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
package intacct
import (
"encoding/xml"
)
type Request struct {
XMLName xml.Name `xml:"request"`
Control Control
Operation RequestOperation
}
func NewRequestV2(config Config, fn interface{}) Request {
login := NewLogin(config.User, config.Company, config.UserPassword)
if config.Location != "" {
login.LocationID = config.Location // TODO remove the ID suffixes?
}
return Request{
Control: NewControlV2(config.Sender, config.SenderPassword),
// TODO Multiple functions?
Operation: RequestOperation{
Authentication: Authentication{
Login: login,
},
Content: Content{
Functions: []interface{}{fn},
},
},
}
}
type RequestOperation struct {
XMLName xml.Name `xml:"operation"`
Authentication Authentication
Content Content `xml:"content"`
}
type Content struct {
Functions []interface{} `xml:"function"`
}